Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how can i view cascade option programatically?

Author  Topic 

maifs
Yak Posting Veteran

57 Posts

Posted - 2010-05-03 : 07:45:58
how can i view cascade option programatically?

i have more than 700 tables in my database.
how can i check the cascade option (whether it would be on or off) for each table?

maifs
Yak Posting Veteran

57 Posts

Posted - 2010-05-03 : 08:37:53
thanks to all.i have found the solution.
SELECT TC.TABLE_NAME,CLU.COLUMN_NAME,RC.CONSTRAINT_NAME ,RC.DELETE_RULE,TC.CONSTRAINT_TYPE
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc ON RC.CONSTRAINT_NAME = TC.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CLU ON CLU.CONSTRAINT_NAME = TC.CONSTRAINT_NAME
where TC.CONSTRAINT_TYPE = 'FOREIGN KEY'
Go to Top of Page
   

- Advertisement -