Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
SSIS Integration Runtime in Azure Data Factory
Returns the number of characters in a character expression. If the string includes leading and trailing blanks, the function includes them in the count. LEN returns identical values for the same string of single and double byte characters.
LEN(character_expression)
character_expression
Is the expression to evaluate.
DT_I4
The character_expression argument can be a DT_WSTR, DT_TEXT, DT_NTEXT, or DT_IMAGE data type. For more information, see Integration Services Data Types.
If character_expression is a string literal or a data column with the DT_STR data type, it is implicitly cast to the DT_WSTR data type before LEN performs its operation. Other data types must be explicitly cast to the DT_WSTR data type. For more information, see Cast (SSIS Expression).
If the argument passed to the LEN function has a Binary Large Object Block (BLOB) data type, such as DT_TEXT, DT_NTEXT, or DT_IMAGE, the function returns a byte count.
LEN returns a null result if the argument is null.
This example returns the length of a string literal. The return result is 12.
LEN("Ball Bearing")
This example returns the difference between the length of values in the FirstName and LastName columns.
LEN(FirstName) - LEN(LastName)
Returns the length of a computer name using the System variable MachineName.
LEN(@MachineName)
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayTraining
Module
Introduction to expressions in Power Automate - Training
Learn how to write expressions in Power Automate.