欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-04-26 11:51:50
...

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.[c

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可能不适用