Subject | Problem with script |
---|---|
Author | Riho-Rene Ellermaa |
Post date | 2004-09-24T08:54:56Z |
I use IBO4.2 Ib, BCB5
I run TIB_Script:
SET AUTODDL ON;
ALTER TABLE CORRESP add COL Varchar(35) NOT NULL;
commit;
update corresp set col='';
update corresp set cref='' where cref is null;
update corresp set col=cref;
commit;
alter table corresp drop cref;
alter table corresp add CREF Varchar(35) NOT NULL;
commit;
update corresp set cref=col;
commit;
alter table corresp drop col;
commit;
alter table corresp drop CONSTRAINT CORRESP_PK;
commit;
alter table corresp ADD CONSTRAINT CORRESP_PK PRIMARY KEY
(NAME,ACCOUNT,SUBACCOUNT,CREF);
commit;
(The extra commits were added in desperation to get it to work.)
In Firebird servers this script works perfectly.
When using IB 6.0, I get error in last row (ADD CONSTRAINT):
ISC ERROR: 335544349
Attempt to store duplicate value (...) in unique index
"RDB$PRIMARY43"
Null segment of UNIQUE KEY
Strange thing is that when I run this script in IBAdmin or IB Manager,
then I don't get this error - the script runs OK.
Can anyone give me a solution to get the script working inside IBO?
Riho Ellermaa
I run TIB_Script:
SET AUTODDL ON;
ALTER TABLE CORRESP add COL Varchar(35) NOT NULL;
commit;
update corresp set col='';
update corresp set cref='' where cref is null;
update corresp set col=cref;
commit;
alter table corresp drop cref;
alter table corresp add CREF Varchar(35) NOT NULL;
commit;
update corresp set cref=col;
commit;
alter table corresp drop col;
commit;
alter table corresp drop CONSTRAINT CORRESP_PK;
commit;
alter table corresp ADD CONSTRAINT CORRESP_PK PRIMARY KEY
(NAME,ACCOUNT,SUBACCOUNT,CREF);
commit;
(The extra commits were added in desperation to get it to work.)
In Firebird servers this script works perfectly.
When using IB 6.0, I get error in last row (ADD CONSTRAINT):
ISC ERROR: 335544349
Attempt to store duplicate value (...) in unique index
"RDB$PRIMARY43"
Null segment of UNIQUE KEY
Strange thing is that when I run this script in IBAdmin or IB Manager,
then I don't get this error - the script runs OK.
Can anyone give me a solution to get the script working inside IBO?
Riho Ellermaa