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

Comments

Popular posts from this blog

Read Images from a xlsx file using Apache POI

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

How to create mail message in FRC822 format