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?
Asked
Active
Viewed 119 times
1
-
possible duplicate of [SQL Server 2008 Empty String vs. Space](http://stackoverflow.com/questions/1399844/sql-server-2008-empty-string-vs-space) – manlio Nov 25 '14 at 14:44
1 Answers
5
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.

Damien_The_Unbeliever
- 234,701
- 27
- 340
- 448