Is it possible to list all foreign keys in a database?

后端 未结 4 925
一个人的身影
一个人的身影 2021-01-30 12:41

How do I list all FK\'s in a sqlserver database?

4条回答
  •  悲哀的现实
    2021-01-30 13:20

    I use http://technet.microsoft.com/en-us/library/ms189807.aspx

    SELECT * FROM sys.foreign_keys
    

    That is if you are on at least SQL Server 2005+ and want to see a list of the FK names.

    But you probably want to know more about the tables that are related too, don't you, that is where the answer comes in handy.

提交回复
热议问题