Know relationships between all the tables of database in SQL Server

前端 未结 7 1996
灰色年华
灰色年华 2020-11-28 05:00

I wish to all know how the tables in my database are related to each other (i.e PK/FK/UK) and hence i created a database diagram of all my tables in SQL Server. The diagram

相关标签:
7条回答
  • 2020-11-28 05:46
    select * from information_schema.REFERENTIAL_CONSTRAINTS where 
    UNIQUE_CONSTRAINT_SCHEMA = 'TABLE_NAME' 
    

    This will list the column with TABLE_NAME and REFERENCED_COLUMN_NAME.

    0 讨论(0)
提交回复
热议问题