Does anybody know if it is possible to find the name of the column over which a primary key is defined?
With the use of systemtables i can find the names of tables which have a primary key:
SELECT sysobjects.name
FROM sysobjects, sysconstraints
WHERE sysobjects.xtype = 'U'
AND sysconstraints.constid in
(SELECT id
FROM sysobjects
WHERE xtype = 'PK')
But i would like to know the name of the column of each table over which the primary key is defined.
The column sysconstraints.colid only contains zero's...
Thanks in advance.
With the use of systemtables i can find the names of tables which have a primary key:
SELECT sysobjects.name
FROM sysobjects, sysconstraints
WHERE sysobjects.xtype = 'U'
AND sysconstraints.constid in
(SELECT id
FROM sysobjects
WHERE xtype = 'PK')
But i would like to know the name of the column of each table over which the primary key is defined.
The column sysconstraints.colid only contains zero's...
Thanks in advance.