Showing posts with label mydata. Show all posts
Showing posts with label mydata. Show all posts

Friday, February 24, 2012

Can someone please explain this to me...

why do the following return the same datasets?

select * from myTable where myData = ''

select * from myTable where myData = ' '

in the first I'm specifically searching empty strings, in the second a sequence of five spaces. Yet both return any and all white character matches? Is this a "feature" of SQL...

P.S. I'm using T-SQL

This should work. Check it out

select * from myTable where myData = '';

select * from myTable where myData = SPACE(5);

|||

Yes, trailing spaces are not significant (nor stored) in varchar fields.