Tuesday, January 4, 2011

DB2 Problem::: SQL0750N The source table cannot be renamed because it is referenced in a view, materialized query table, trigger, SQL function, SQL m

Problem: SQL0750N The source table cannot be renamed because it is referenced in a view, materialized query table, trigger, SQL function, SQL method, check constraint, or referential constraint...............


Solution: First please see all referential constraint on a table using following command

db2 select constname, tabname, refkeyname, reftabname, colcount, deleterule, updaterule from syscat.references


----------------------------------------------------------
CONSTNAME TABNAME REFKEYNAME REFTABNAME COLCOUNT DELETERULE UPDATERULE
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------- ---------- ----------
--------------------------------------------------------------

Now note down the constant name....say
CC1158245432444


Now give command.....

ALTER TABLE TABLE_NAME DROP FOREIGN KEY CC1158245432444;

Now you can rename that table........

No comments:

Post a Comment