Col_Name( object_id, column_id [, dbid] )
Returns the column name of the specified object as stored in syscolumns (ASE) or sys.columns (MS SQL Server).
Example
select Col_Name( Id, ColId ) from syscolumns
where Id = Object_Id('T_Country')
Differences
In MS SQL Server, the function Col_Name
only has two arguments. You cannot use the function to ask for a column name in another database.
In ASE, meta data about columns of tables and parameters of stored procedures are stored in syscolumns. In MS SQL Server, meta data about columns are stored in sys.columns
, whereas meta data about parameters are stored in sys.parameters
. Consequently, in ASE Col_Name
can return the name of a parameter, but in MS SQL Server, this does not work.