In SQL Server, you can use the sp_special_columns
system stored procedure to identify a unique identifier for the table. Specifically, it returns the optimal set of columns that uniquely identify a row in the table. It also returns columns automatically updated when any value in the row is updated by a transaction.
sp_special_columns
is equivalent to SQLSpecialColumns in ODBC.
If there are no columns that can uniquely identify the table, the result set is empty.