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 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........

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Android: where to run keytool command in android