Transact-SQL Reference

COL_LENGTH

Returns the defined length (in bytes) 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 shows the return values for a column of type varchar(40) and a column of type nvarchar(40).

USE pubs
GO
CREATE TABLE t1
   (c1 varchar(40),
    c2 nvarchar(40)
)
GO
SELECT COL_LENGTH('t1','c1')AS 'VarChar',
      COL_LENGTH('t1','c2')AS 'NVarChar'
GO
DROP TABLE t1

Here is the result set.

VarChar     NVarChar
40          80

See Also

Expressions

Metadata Functions

'

Comments ( )
Link to this page: //www.vb-net.com/Sql/Sql/Ts_ca-co_26eg.htm
< THANKS ME>