rynox
12-02-2005, 09:34 PM
I want to do a query on a db's system tables to determine what column(s) are part of the primary key.
Example. SELECT syscolumns.[name]
FROM sysobjects,syscolumns,systypes
WHERE sysobjects.id=syscolumns.id AND
systypes.xtype=syscolumns.xtype AND
sysobjects.name='tablename'
Yields all the column names. But I just want to see those that are part of the primary key.
Ryan
Example. SELECT syscolumns.[name]
FROM sysobjects,syscolumns,systypes
WHERE sysobjects.id=syscolumns.id AND
systypes.xtype=syscolumns.xtype AND
sysobjects.name='tablename'
Yields all the column names. But I just want to see those that are part of the primary key.
Ryan