Monday, 16 July 2018

Sql Server LEN



LEN in function is used to get the length . LEN function always return numeric values as length. Length function works on null , space , even number.LEN function do not consider the ending spaces ,but is consider starting space.


Here is the result,LEN function return length of character.
Example 1

SELECT LEN('Hello World!');
Result: 12


Here is the result,LEN function does not consider ending space.
Example 2

SELECT LEN('Hello World! ');
Result: 12 (trailing spaces are not included in the calculation)


Here is the result,LEN function consider starting space.
Example 3
SELECT LEN(' Hello World!');
Result: 15


Here is the result,LEN function consider starting space but not ending space.
Example 4
SELECT LEN(' Hello World! ');
Result: 15


Here is the result,LEN function does not consider ending space.
Example 5
SELECT LEN(' ');
Result: 0

Here is the result,LEN function does not consider ending space.
Example 6
SELECT LEN('');
Result: 0


Example 7
SELECT LEN(NULL);
Result: NULL

No comments:

Post a Comment

বাঙালির বেড়ানো সেরা চারটি ঠিকানা

  বাঙালি মানে ঘোড়া পাগল | দু একদিন ছুটি পেলো মানে বাঙালি চলল ঘুরতে | সে সমুদ্রই হোক , পাহাড়ি হোক বা নদী হোক। বাঙালির ...