Re: How to find records with length greater than 17
"Plamen Ratchev" <Plamen@SQLStud io.comwrote in message
news:t9ednRsfVu 9McZHVnZ2dnUVZ_ jSdnZ2d@speakea sy.net...
The LEN function returns the number of characters excluding trailing
blanks:
>
SELECT namecol
FROM Foo
WHERE LEN(namecol) 17;
>
The DATALENGTH function returns the number of bytes.
>
HTH,
>
Plamen Ratchev http://www.SQLStudio.com
Wouldnt it matter if the field was in unicode then? What do you do if you
want to include the spaces?
I dont really want to know I just thought it weird that len would behave
like that...(Im an SQL server noob)
Re: How to find records with length greater than 17
There is no difference when you use LEN with Unicode column. If you need to
include the spaces you can use DATALENGTH. The only considerations is that
it returns number of bytes, so for NVARCHAR/NCHAR/NTEXT will return double
the length.
Re: How to find records with length greater than 17
On Apr 21, 3:36 pm, "Plamen Ratchev" <Pla...@SQLStud io.comwrote:
The LEN function returns the number of characters excluding trailing blanks:
>
SELECT namecol
FROM Foo
WHERE LEN(namecol) >17;
>
The DATALENGTH function returns the number of bytes.
>
HTH,
>
Plamen Ratchevhttp://www.SQLStudio.c om
Right - i dont want to include spaces.
I want to check where the first word is greater than 17
Comment