Returns information about a column or procedure parameter.
COLUMNPROPERTY(id, column, property)
| 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 |
int
This example returns the length of the au_lname column.
SELECT COLUMNPROPERTY( OBJECT_ID('authors'),'au_lname','PRECISION')
| OBJECTPROPERTY | Metadata Functions |
| TYPEPROPERTY |