Wednesday, 21 February 2024

length Function in MSSQL

In Microsoft SQL Server (MSSQL), the LEN function is used to return the number of characters in a string expression. Here's how you can use the LEN function with an example:


SELECT LEN('Hello World') AS string_length;


In this example, 'Hello World' is a string literal. The LEN function is applied to this string, and it returns the length of the string, which is 11 characters.


The output of this query would be:


string_length

-------------

11

This demonstrates how to use the LEN function in MSSQL to find the length of a string.

No comments:

Post a Comment