A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

col_length()

The System Function col_length() returns the defined length for a column of a table. To determine the length of the data stored in the column, the function datalength() can be used.

Syntax of the System Function col_length()

    col_length ( object_name, column_name)
    

The Parameters of the System Function col_length()

"object_name"
The parameter "object_name" is the name of an object in the database. A valid object can be a table, view, procedure, trigger or rule. The object can be referenced using the fully qualified name, i.e. using the name of the database, owner and object. The parameter "object_name" must be set in single or double quotes.

"column_name"
The parameter "column_name" is the name of a column.

Example for the System Function col_length()

    select col_length("table_name", "column_name")
go
-----
90

Returns the defined length (90) of the column "column_name".

    select col_length("db_name.owner.table_name", "column_name")
    
go
-----
90

Fully qualified reference of the object. Returns the defined lenth of the column "column_name" in the object "table_name" within the database "db_name".

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
data_pgs(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
isnull(),
lct_admin(),
license_enabled(),
lockscheme(),
next_identity(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().