OU blog

Personal Blogs

Inflammable means Flammable?! What a DBMS.

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:12

So, I was getting down and dirty with some MS SQL today.

Loving it - standard. Aside from some basic string manipulation which I begrudgingly decided to leave out from the client code the procedure was quite straight-forward. Anyway, I wanted to determine the last character of a string and came across some odd LEN behaviour illustrated as follows:

Len of beard script

Returns:

Expected LEN

Right?

 

Wrong! You get:

SQL Results

So LEN ignores trailing spaces. I know it says as much, and very clearly, in the documentation but who would have expected that...?

Permalink Add your comment
Share post