Query to get all foreign key constraints in SQL Server 2000

前端 未结 3 815
生来不讨喜
生来不讨喜 2020-12-15 01:44

I need a query for SQL Server 2000 to get a list of all foreign keys.

Particularly all the foreign keys that point to a particular column.

How do I write thi

3条回答
  •  粉色の甜心
    2020-12-15 02:32

    select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
    

    If you need more information about the key then you can join it to the INFORMATION_SCHEMA.KEY_COLUMN_USAGE view, which contains the columns referenced by the key.

提交回复
热议问题