Wednesday, 15 February 2012

sql - Column is blank but doesn't qualify where clause -



sql - Column is blank but doesn't qualify where clause -

when run query:

select lr.id, lr.hide location_room lr lr.lid = 19624

i get:

when run 2nd query:

select lr.hide, id location_room lr lr.lid = 19624 , (lr.hide = ' ' or lr.hide null or lr.hide = '' or datalength(lr.hide) = 0)

i result:

i need check hide isn't null or blank, can't seem so.

the column set this:

why happening? how can resolve it?

it looks have funny character in data. can see ascii value of first character in hide using ascii():

select ascii(left(hide, 1)) location_room;

or perhaps:

select ascii(left(ltrim(rtrim(hide)), 1)) location_room;

sql sql-server sql-server-2008

No comments:

Post a Comment