>Are there fast/efficient calls to determine the primary key columns and/or the identity column for a table?
>
>The best I can find for the PK is to call SP_HELPINDEX and then look through the result set to find the phrase "PRIMARY KEY" in the description. The index_keys column for that row contains the column(s) that make up the PK.
>
>As for the IDENTITY column, I call OBJECTPROPERTY() to determine if the table has one, then loop through the columns calling COLUMNPROPERTY() to figure out which one it is.
>
>Seems to me there would be a better way.
>
>Thanks in advance,
>Mike Yeager
You can use sp_pkeys() to get info about primart keys.
--sb--