Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 35736

SQL 2000 Determine primary key from system table 列出所有Primary Key

$
0
0

SQL 2000 Determine primary key from system table 列出所有Primary Key

 SELECT object_name(a.[id]) as [TableName]
,object_name(a.constid) as [PK_name]
,b.[name] as [PK_Column]
FROM sysconstraints a inner join syscolumns b
on a.[colid]+1 = b.[colid] and a.[id] = b.[id]
WHERE a.status = 2593

PS. Status=2593還未找到確認的文件說明,另外覆合Key可能不適用

Viewing all articles
Browse latest Browse all 35736

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>