Thursday, October 7, 2010

TSQL quirks

I was always sure that len in TSQL is "length",
but NOT: it is "length without trailing spaces":

select len('12345     ') returns 5

It took a while to find what I really need: 
select DATALENGTH('12345     'returns 10

No comments:

Post a Comment