Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

COL_NAME

SQL Server 2000

Returns the name of a database column given the corresponding table identification number and column identification number.

Syntax

COL_NAME ( table_id , column_id )

Arguments

table_id

Is the identification number of the table containing the database column. table_id is of type int.

column_id

Is the identification number of the column. column_id parameter is of type int.

Return Types

sysname

Remarks

The table_id and column_id parameters together produce a column name string.

For more information about obtaining table and column identification numbers, see OBJECT_ID.

Examples

This example returns the name of the first column in the Employees table of the Northwind database.

USE Northwind
SET NOCOUNT OFF
SELECT COL_NAME(OBJECT_ID('Employees'), 1)

Here is the result set:

EmployeeID

(1 row(s) affected)

See Also

Expressions

Metadata Functions

sysobjects

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft