tags:

views:

15

answers:

2
select *
from ss.mailer_data
where
id = 249122
and address_3 like'%%'

will not hit on address_3. I've tried changing the last line to

and address_3 is null

and address_3 = ''

and address_3 = ' '

I tried using char_length, ascii functions and they return nothing for that filed value. Anyone have any ideas?

A: 

could also be that id = 249122 is not true for that combination. What happens when you do

select *
from ss.mailer_data
where address_3 is null

or

select *
from ss.mailer_data
where address_3 = ''
SQLMenace
ya know i hit on = null when i did it that way. i changed the order of the where clause and now it's hitting but that should not have been an issue (i think..). My sanity is slipping ;) thanks
SibLiant
A: 

NULL is a special case - It's undefined but if that were your problem, Is Null should've found it

Can I ask you what data IS actually stored in Address3?

If you just want all records where address3 is empty/null,

select *
from ss.mailer_data
where
RTRIM(COALESCE(address_3, '')) =''

NB: LIKE is computationally expensive so use it carefully. Also, like '%%' is identical to Like '%'

Are you sure you had the right Id?

Basiclife