Subject | Re: [firebird-support] Changing Primary Key datatype |
---|---|
Author | Helen Borrie |
Post date | 2003-07-13T09:03:44Z |
At 08:01 AM 13/07/2003 +0000, you wrote:
pointing to this primary key.
1 - remove the foreign key constraint(s) first and commit
2 - Then remove the primary key constraint and commit
3. Next do ALTER COLUMN on all of the affected columns and commit
After that, do
4. Re-add the primary key constraint and commit
5 Re-add the foreign key constraint and commit
heLen
>Is it possible to change a PK datatype from SMALLINT to INTEGER?It's possible to change a smallint column to an integer.
>I've though I'd removed all the dependants,What do you mean here? what did you remove and how did you do it?
>but get an errorIt just means there is still at least one table that has a foreign key
>messages like...
>
>ALTER TABLE CATEGORY3 drop constraint INTEG_101;
>// $$ ******** ERROR ************* $$
>//FAILED - unsuccessful metadata update
>//ERASE RDB$RELATION_CONSTRAINTS failed
>//action cancelled by trigger (1) to preserve data integrity
>//Cannot delete PRIMARY KEY being used in FOREIGN KEY
>definition.
pointing to this primary key.
>The order of dependency removal is:
>//
>commit;
>
>SET term ^;
>
>ALTER TABLE CATEGORY3
>ALTER COLUMN CAT3NO TYPE INTEGER^
>// $$ ******** ERROR ************* $$
>//FAILED - unsuccessful metadata update
>//MODIFY RDB$RELATION_FIELDS failed
>//action cancelled by trigger (1) to preserve data integrity
>//Cannot update index segment used by an Integrity Constraint
1 - remove the foreign key constraint(s) first and commit
2 - Then remove the primary key constraint and commit
3. Next do ALTER COLUMN on all of the affected columns and commit
After that, do
4. Re-add the primary key constraint and commit
5 Re-add the foreign key constraint and commit
heLen