Returns the defined length of a column.
col_length(object_name, column_name)
is name of a database object, such as a table, view, procedure, trigger, default, or rule. The name can be fully qualified (that is, it can include the database and owner name). It must be enclosed in quotes.
is the name of the column.
Finds the length of the title column in the titles table. The “x” gives a column heading to the result:
select x = col_length("titles", "title")
x ---- 80
col_length, a system function, returns the defined length of column.
To find the actual length of the data stored in each row, use datalength.
For text, unitext, and image columns, col_length returns 16, the length of the binary(16) pointer to the actual text page.
For unichar columns, the defined length is the number of Unicode values declared when the column was defined (not the number of bytes represented).
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute col_length.
Documentation Transact-SQL Users Guide
Function datalength