Click to See Complete Forum and Search --> : PrimaryKey


Nagham
November 14th, 2006, 02:06 AM
How can I know by a query if a column is a primary key or not

Shuja Ali
November 14th, 2006, 03:12 AM
Which database are you using? In case of SQL 2000 you can use the stored proced sp_helpcontraint to find out which column in a particular table is a primary/foreign key. Something like this will display a list of contrainst for a table sp_helpconstraint TABLENAME, 'nomsg'

cjard
November 14th, 2006, 12:14 PM
try and insert NULL into it (impossible to do to a pk field)

say what database youre using. we arent telepaths...