Subject | Re: [firebird-support] Problem with script .. any help appreciated. |
---|---|
Author | Adrian Wreyford |
Post date | 2009-06-21T13:56:25Z |
Hi Dimitry,
ALTER TABLE ANIMALDISEASEINJURY DROP CONSTRAINT FK_ANIMALDISEASEINJURY_1;
Commit work;
ALTER TABLE ANIMALDOSING DROP CONSTRAINT FK_ANIMALDOSING_1;
Commit work;
ALTER TABLE ANIMALPERFORMANCE DROP CONSTRAINT FK_ANIMALPERFORMANCE_1;
Commit work;
ALTER TABLE ANIMALPHOTO DROP CONSTRAINT FK_ANIMALPHOTO_1;
Commit work;
ALTER TABLE ANIMALPROGRESS DROP CONSTRAINT FK_ANIMALPROGRESS_1;
Commit work;
ALTER TABLE ANIMALSIRE DROP CONSTRAINT FK_ANIMALSIRE_1;
Commit work;
ALTER TABLE CANCEL DROP CONSTRAINT FK_CANCEL_1;
Commit work;
ALTER TABLE ANIMAL DROP CONSTRAINT UNQ_ANIMAL_1;
Commit work;
ALTER TABLE ANIMAL DROP CONSTRAINT ANIMAL_PK;
Commit work;
ALTER TABLE ANIMAL ADD TEMP$$ANIMALID INTEGER NOT NULL;
Commit work;
UPDATE ANIMAL SET TEMP$$ANIMALID = CAST(ANIMALID AS INTEGER) WHERE ANIMALID
IS NOT NULL;
Commit work;
ALTER TABLE ANIMAL DROP ANIMALID;
Commit Work;
ALTER TABLE ANIMAL ADD ANIMALID INTEGER NOT NULL;
Commit Work;
UPDATE ANIMAL SET ANIMALID = TEMP$$ANIMALID WHERE TEMP$$ANIMALID IS NOT
NULL;
Commit Work;
ALTER TABLE ANIMAL ALTER ANIMALID POSITION 3;
Commit work;
ALTER TABLE ANIMAL DROP TEMP$$ANIMALID;
Commit Work;
Results in a successfull execution.
?It gives an error when I recreate all the constraints??
Thanks
Adrian
> When you run your script in Development Studio or other tool,Just running the script with the following:
> transaction is committed after each DDL. When you run the script in
> IBScript component it isn't. Mixing DDL and DML in one transaction
> always lead to errors like yours.
> SY, SD.
ALTER TABLE ANIMALDISEASEINJURY DROP CONSTRAINT FK_ANIMALDISEASEINJURY_1;
Commit work;
ALTER TABLE ANIMALDOSING DROP CONSTRAINT FK_ANIMALDOSING_1;
Commit work;
ALTER TABLE ANIMALPERFORMANCE DROP CONSTRAINT FK_ANIMALPERFORMANCE_1;
Commit work;
ALTER TABLE ANIMALPHOTO DROP CONSTRAINT FK_ANIMALPHOTO_1;
Commit work;
ALTER TABLE ANIMALPROGRESS DROP CONSTRAINT FK_ANIMALPROGRESS_1;
Commit work;
ALTER TABLE ANIMALSIRE DROP CONSTRAINT FK_ANIMALSIRE_1;
Commit work;
ALTER TABLE CANCEL DROP CONSTRAINT FK_CANCEL_1;
Commit work;
ALTER TABLE ANIMAL DROP CONSTRAINT UNQ_ANIMAL_1;
Commit work;
ALTER TABLE ANIMAL DROP CONSTRAINT ANIMAL_PK;
Commit work;
ALTER TABLE ANIMAL ADD TEMP$$ANIMALID INTEGER NOT NULL;
Commit work;
UPDATE ANIMAL SET TEMP$$ANIMALID = CAST(ANIMALID AS INTEGER) WHERE ANIMALID
IS NOT NULL;
Commit work;
ALTER TABLE ANIMAL DROP ANIMALID;
Commit Work;
ALTER TABLE ANIMAL ADD ANIMALID INTEGER NOT NULL;
Commit Work;
UPDATE ANIMAL SET ANIMALID = TEMP$$ANIMALID WHERE TEMP$$ANIMALID IS NOT
NULL;
Commit Work;
ALTER TABLE ANIMAL ALTER ANIMALID POSITION 3;
Commit work;
ALTER TABLE ANIMAL DROP TEMP$$ANIMALID;
Commit Work;
Results in a successfull execution.
?It gives an error when I recreate all the constraints??
Thanks
Adrian