понеділок, 29 березня 2010 р.

How to get the length of a string containing only spaces

DATALENGTH function returns string length in bytes:

DECLARE @str VARCHAR(10)
SET @str= '      '
PRINT LEN(@str)
PRINT DATALENGTH(@str)

Result:

0
6

1 коментар: