Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Meta Data FunctionsRSS Feeds

COL_LENGTH Function

Posted By: Sarita Patel     Category: SQL Server     Views: 3464

This article explains about COL_LENGTH function in sql server with examples.

COL_LENGTH function is used to get defined length of a column in bytes.


Syntax of COL_LENGTH Function :

COL_LENGTH ( 'table' ,'column' )

table is a name of a table for which to get column length. It is of type nvarchar.

column is a name of the column for which to get length. It is of type nvarchar.  

Return type of COL_LENGTH function is an integer.



Examples of COL_LENGTH Function :

Example 1 : Use of COL_LENGTH function in select clause

SELECT COL_LENGTH('Customers','ContactName')

Output
510

Above example returns length of column ContactName of Customers table in bytes where ContactName is of type nvarchar(255).
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on COL_LENGTH Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of COL_LENGTH Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!