How can I list all foreign keys referencing a given table in SQL Server?

后端 未结 26 3079
梦毁少年i
梦毁少年i 2020-11-22 07:13

I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the tabl

26条回答
  •  执笔经年
    2020-11-22 07:54

    SELECT
      object_name(parent_object_id),
      object_name(referenced_object_id),
      name 
    FROM sys.foreign_keys
    WHERE parent_object_id = object_id('Table Name')
    

提交回复
热议问题