How to determine the primary key for a table in SQL Server?

后端 未结 8 2017
小蘑菇
小蘑菇 2020-12-16 07:13

What I\'d like to be able to do in SQL Server 2005 somehow is with a table name as input determine all the fields that make up the primary key. sp_columns doesn

8条回答
  •  鱼传尺愫
    2020-12-16 07:45

    In SQL2005 this brings back a row that names the primary key and then gives a list of the column under "index_keys"

    sp_help myTable
    

提交回复
热议问题