Reputation: 2089
I am working in SQL Server 2008. Previously, I thought empty strings (i.e., '') were different than strings of just white space characters (e.g., ' '). Also, I thought that white space strings of different lengths were different from each other (e.g., ' ' vs. ' '). However, it seems that SQL treats all of these the same. That is, empty strings are the same as white space strings of any length. Is this expected?
Upvotes: 1
Views: 318
Reputation: 239636
It's not white space in the conventional sense of any invisible character that affects spacing (such as tab, newline, etc) - it's only the literal space character (ASCII 32)
And it's standard SQL - if two strings are of unequal length, the shorter string is padded with spaces before comparisons occur.
Upvotes: 5