Thursday 19 February 2015

The LENGTH Function in SQL

The LENGTH function returns the length of character. Note that it is a character function that returns the answer in numbers, as shown in the following example where it is used to count number of character in the first names of employees.

NOTE
In Microsoft SQL Server and Microsoft Access use DATALENGTH() and LEN() functions, respectively.


    Syntax :
LENGTH (character)


    SQL Statement :
SELECT    first_name, LENGTH(first_name) Length
FROM       employees;


    Output :









No comments:

Post a Comment