col_length

Returns the defined length of a column.

Syntax

col_length(object_name, column_name)

Parameters

Examples

Usage

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.

  • unichar columns – the defined length is the number of Unicode values declared when the column was defined (not the number of bytes represented).

See also Transact-SQL Users Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute col_length.

Related reference
datalength