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
Tags: SQL Server String Functions SQL SQL Server Functions. Character String Data Types and Functions with Sample SQL Statements. Quick reference, Data Type Tables, Function Tables.
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