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
You can try this:
SELECT name, delete_referential_action_desc
FROM sys.foreign_keys
Little late to the game here, but you might also try this:
select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With