Saturday, February 21, 2015

Nitheen Kumar

LEN Function in SQL Server

 
SQL Server String Functions

SQL Server string functions are scalar functions that perform an operation on a string input value and return a string or numeric value.

LEN Function

The LEN function finds the length of the character string. The function takes the string as a single argument. For example, the following query shows the length of each city name:

SELECT  LEN(city) AS number_of_characters,  City  FROM dimGeography

Results:

Number_of_characters City
10 Alexandria
13 Coffs Harbour
12 Darlinghurst
8 Goulburn
9 Lane Cove
Note: use the DATALENGTH system function to determine the number of characters in a TEXT column
Subscribe to get more Posts :