Returns defined length in
bytes of column.
SYNTAX:
Select (‘tablename’,’Columnname’)
CREATE TABLE Tbl_emp
(
ID INT IDENTITY(1,1) PRIMARY KEY,
Name VARCHAR(50),
Department NVARCHAR(50)
)
Example -1:
SELECT COL_LENGTH('Tbl_emp','Name') AS ColLength
Example -2:
SELECT COL_LENGTH('Tbl_emp','Department') AS ColLength
Example -3:
SELECT COL_LENGTH('Tbl_emp','Address') AS ColLength
In above
example 3 null value is returned .beacuase of Address column does not belongs
to Tbl_emp table.
Comments
Post a Comment