獲取有關外來鍵約束的資訊
sys.foreignkeys 系統檢視返回有關資料庫中所有外來鍵關係的資訊:
select name,
OBJECT_NAME(referenced_object_id) as [parent table],
OBJECT_NAME(parent_object_id) as [child table],
delete_referential_action_desc,
update_referential_action_desc
from sys.foreign_keys