How can I find out what FOREIGN KEY constraint references a table in SQL Server?

前端 未结 15 843
再見小時候
再見小時候 2020-12-04 05:12

I am trying to drop a table but getting the following message:

Msg 3726, Level 16, State 1, Line 3
Could not drop object \'dbo.UserProfile\' bec

15条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 06:08

    Another way is to check the results of

    sp_help 'TableName'
    

    (or just highlight the quoted TableName and pres ALT+F1)

    With time passing, I just decided to refine my answer. Below is a screenshot of the results that sp_help provides. A have used the AdventureWorksDW2012 DB for this example. There is numerous good information there, and what we are looking for is at the very end - highlighted in green:

提交回复
热议问题