views:

21

answers:

1

In SQL Server 2005, can I issue an SQL query to list all FK constraints on tables within the DB, and show the delete rule? (ie nothing, cascade, set null, or set default)

The output I'm looking for is something akin to:

FK_NAME                  ON_DELETE
==================================
FK_LINEITEM_STATEMENT    CASCADE
FK_ACCOUNTREP_CLIENT     NOTHING
+3  A: 

You can try this:

SELECT name, delete_referential_action_desc
FROM sys.foreign_keys
bobs
Thank you. I was doing things the MS way and double-clicking my way to RSI before you provided this little nugget.
Synesso