> How to get the list of columns which compose the PK (notEXEC sp_pkeys 'tablename'> the clustered index) on a table?
Don't do this. System tables may change or disappear in future versions, so> I want to get it from system tables.
your code will break. At least if you use a system proc (or
INFORMATION_SCHEMA views, when possible), your code will have a chance of
living through version upgrades...