查询查找所有FK约束及其删除规则(SQL Server) [英] Query to find all FK constraints and their delete rules (SQL Server)
本文介绍了查询查找所有FK约束及其删除规则(SQL Server)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在SQL Server 2005中,我可以发出SQL查询以列出DB中的表上的所有FK约束,并显示删除规则吗? (即无,级联,设置为null或设置为默认值)
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
推荐答案
您可以尝试:
SELECT name, delete_referential_action_desc
FROM sys.foreign_keys
这篇关于查询查找所有FK约束及其删除规则(SQL Server)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文