Subject Adding Unique Constraint Problem
Author James
Hi,

Iam using FB 1.5 Final Release. Iam having adding a unique contraint
with this table ...

CREATE TABLE WEEKLYDEPOSITREPORT (
ID INTEGER NOT NULL,
DATE_FROM DATE NOT NULL,
DATE_TO DATE NOT NULL,
DEP_NO SMALLINT NOT NULL,
AMOUNT NUMERIC(15,2) NOT NULL,
CREATE_ON TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
EDIT_ON TIMESTAMP
);





/******************************************************************************/
/**** Unique
Constraints ****/
/******************************************************************************/

ALTER TABLE WEEKLYDEPOSITREPORT ADD CONSTRAINT UNQ_WEEKLYDEPOSITREPORT2
UNIQUE (DATE_TO);


/******************************************************************************/
/**** Primary
Keys ****/
/******************************************************************************/

ALTER TABLE WEEKLYDEPOSITREPORT ADD CONSTRAINT FK_WEEKLYDEPOSITREPORT
PRIMARY KEY (ID);


/******************************************************************************/
/****
Triggers ****/
/******************************************************************************/


SET TERM ^ ;




/* Trigger: EDITLOG_WEEKLYDEPOSITREPORT */
CREATE TRIGGER EDITLOG_WEEKLYDEPOSITREPORT FOR WEEKLYDEPOSITREPORT
ACTIVE BEFORE UPDATE POSITION 0
AS
begin
/* Trigger text */
NEW.edit_on = current_timestamp;
end
^

/* Trigger: ID_WEEKLYDEPOSITREPORT */
CREATE TRIGGER ID_WEEKLYDEPOSITREPORT FOR WEEKLYDEPOSITREPORT
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(GEN_WEEKLYDEPOSITREPORT_ID,1);
END
^


SET TERM ; ^


As you can see here. I can add the date_to field to unique contraint
while Iam having problem when Iam adding date_from to unique contraint

Here is the error message ...

---------- STATEMENT ----------

alter table WEEKLYDEPOSITREPORT
add constraint UNQ_WEEKLYDEPOSITREPORT
unique (DATE_FROM)


---------- ERROR MESSAGE ----------

Invalid insert or update value(s): object columns are
constrained - no 2 table rows can have duplicate column values.
attempt to store duplicate value (visible to active transactions) in
unique index "UNQ_WEEKLYDEPOSITREPORT".

Please help. Thanks

regards,
james