col_name

Description

Returns the name of the column whose table and column IDs are specified.

Syntax

col_name(object_id, column_id[, database_id])

Parameters

object_id

is a numeric expression that is an object ID for a table, view, or other database object. These are stored in the id column of sysobjects.

column_id

is a numeric expression that is a column ID of a column. These are stored in the colid column of syscolumns.

database_id

is a numeric expression that is the ID for a database. These are stored in the db_id column of sysdatabases.

Examples

Example 1

select col_name(208003772, 2)

------------------------------ 
title

Usage

Standards

SQL92 – Compliance level: Transact-SQL extension.

Permissions

Any user can execute col_name.

See also

Functions db_id, object_id