Friday, March 1, 2013

SQL Server LEN Function

In this post , I will explain the LEN function of SQL Server of string function category.
In my previous posts, I explained UNICODE Function, LEFT Function, CHARINDEX Function, CHAR Function, ASCII Function, Simple script to backup all SQL Server databases, Table-Valued Parameters and some other articles related to SQL Server.

Here, I am going to explain LEN function of SQL Server.

LEN() Function

This function returns the number of characters of input string expression, excluding trailing blank
 
Syntax- LEN(string_expression)
Arguments-
  • string_expression : string_expression is the string value to be evaluated.
Return Type- integer

Example-
 
DECLARE @nstring nchar(12)
SET @nstring = 'DotNetWorld'
SELECT Len(@nstring)
--Output 11


2 comments:

^ Scroll to Top