COLUMNPROPERTY (T-SQL)

Returns information about a column or procedure parameter.

Syntax

COLUMNPROPERTY(id, column, property)

Arguments
id
Is an expression containing the ID of the table or procedure.
column
Is an expression containing the name of the column or parameter.
property
Is an expression containing the information to be returned for id, and can be any of these values.

 

Value Description Value returned
AllowsNull Allows null values. 1 = True
0 = False
NULL = Invalid input
IsComputed The column is a computed column. 1 = True
0 = False
NULL = Invalid input
IsCursorType The procedure parameter is of type CURSOR. 1 = True
0 = False
NULL = Invalid input
IsFulltextIndexed The column has been registered for Full-Text indexing. 1 = True
0 = False
NULL = Invalid input
IsIdentity The column uses the IDENTITY property. 1 = True
0 = False
NULL = Invalid input
IsIdNotForRepl The column checks for the IDENTITY_INSERT setting. If IDENTITY NOT FOR REPLICATION is specified, the IDENTITY_INSERT setting is not checked. 1 = True
0 = False
NULL = Invalid input
IsOutParam The procedure parameter is an output parameter. 1 = True
0 = False
NULL = Invalid input
IsRowGuidCol The column has the uniqueidentifier data type and is defined with the ROWGUIDCOL property. 1 = True
0 = False
NULL = Invalid input
Precision Precision for the data type of the column or parameter. The precision of the specified column data type.

NULL = Invalid input

Scale Scale for the data type of the column or parameter. The scale

NULL = Invalid input

UsesAnsiTrim ANSI padding setting was ON when the table was initially created. 1= True
0= False
NULL = Invalid input

Return Types

int

Examples

This example returns the length of the au_lname column.

SELECT COLUMNPROPERTY( OBJECT_ID('authors'),'au_lname','PRECISION')

  

See Also
OBJECTPROPERTY Metadata Functions
TYPEPROPERTY  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.