-
Primary key columns in a table
Hi!
How can I find all columns in a table that are part of the primary key of that table?
SELECT so.Name, sc.*
FROM syscolumns sc
LEFT OUTER JOIN sysobjects so ON sc.Id = so.Id
WHERE so.Name = 'TABLENAME'
Gives me all the columns in a table.
There is also a "type" column. Is there a specific type that tells me where this colum is part of the PK?
This is Sql Server 7 on Win2k.
Any idea?
Thanks,
Helmut
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|