Wednesday, May 27, 2009

LEN and Char in SQL

len in MS SQL will not count the space in the end.

Ex: select len(' ') will return 0
Ex: select len('a ') will only return 1


If char is defined in store procedure parameter, the space will fill in the end to the length of char.

ex: @comment char (100)
when null value passed in, @comment will equal to 100 space.

0 comments: