COL_LENGTH (T-SQL)

Returns the defined length of a column.

Syntax

COL_LENGTH('table', 'column')

Arguments
'table'
Is the name of the table for which to determine column length information. table is an expression of type nvarchar.
'column'
Is the name of the column for which to determine length. column is an expression of type nvarchar.
Return Types

int

Examples

This example finds the length of the title column in the titles table. The x gives a column heading to the result.

USE pubs

SELECT COL_LENGTH('titles', 'title') AS x

  

Here is the result set:

x  

------

80 

  

(1 row(s) affected)

  

See Also
Expressions Metadata Functions

  


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