A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

col_name()

The system function col_name() returns the name of a column in a table.

Syntax of the System Function col_name()

    col_name ( object_id, column_id [, database_id])
    

The parameters of the system function col_name()

"object_id"
The parameter "object_id" is the unique identifier (id) of a table, view or any other object. The id of an object can be retrieved from the system table sysobjects. It is stored in the column "id".

"column_id"
The parameter "column_id" is the unique identifier (id) of a column. The id of a column is stored in the column "colid" of the system table syscolumns.

"database_id"
The parameter "database_id" is the unique identifier (id) of a database. The id of a database is stored in the column "db_id" of the system table sysdatabases, which is located in the master database.

Example for the system function col_name()

    select col_name(208003772, 2)
go
-----
column_name

Prints the name of the column.

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
data_pgs(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
isnull(),
lct_admin(),
license_enabled(),
lockscheme(),
next_identity(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().