Returns the optimal set of columns that uniquely identify a row in a table or view; can also return a list of timestamp columns, with values that are automatically generated when any value in the row is updated by a transaction.
sp_special_columns table_name [, table_owner] [, table_qualifier] [, col_type]
sp_special_columns systypes
scope column_name data_type type_name precision length scale ------ ------------ ---------- ---------- ---------- ------- ------ 0 name 12 varchar 30 30 NULL
sp_special_columns @table_name=authors, @col_type=R
scope column_name data_type type_name precision length scale ------ ------------ ---------- ---------- ---------- ------- ------ 0 au_id 12 varchar 11 11 NULL
The results set for sp_special_columns is:
Column |
Datatype |
Description |
---|---|---|
scope |
int |
NOT NULL. Actual scope of the row ID. The SAP ASE server always returns 0. |
column_name |
varchar(30) |
NOT NULL. Column identifier. |
data_type |
smallint |
The integer code for an ODBC datatype. If this datatype cannot be mapped to an ANSI/ISO type, the value is NULL. The native datatype name is returned in the type_name column. |
type_name |
varchar(13) |
The string representation of the datatype. This is the datatype name as presented by the underlying DBMS. |
precision |
int |
The number of significant digits. |
length |
int |
The length in bytes of the datatype. |
scale |
smallint |
The number of digits to the right of the decimal point. |
Any user can execute sp_special_columns.