Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Primary Keys

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-15 : 20:44:17
Joel writes "Where are the primary keys stored in the system tables...
(other than using sp_pkeys [tableName])

I want to do something like this:

declare @var varchar(500)
select @var = coalesce(@var + ',' + C.Name,C.Name)
from sysObjects O
join syscolumns C on O.id=C.id
where O.name = '[tableName]'
[AND COLID = PRIMARY KEY]

but I can't find the column/table that tells which columns make up the PRIMARY KEY!"
   

- Advertisement -