Please look into the below query
declare @t table(roleid int null,EmailAddress varchar(50) null)
insert into @t select null,'fghfgf' union all select 1,null union all select 2,'xcfgcgcfg'
select * from @t
declare @role_id int = null
select EmailAddress from @t where roleid = @role_id
If I pass 1 0r 2 as value to @role_id I am able to get the correct email address. However, it refuse to return result in case when the value is assign as NULL.
How can I make the program work for both the cases?
Thanks
in SQL (the MS flavour) an operation involving a NULL returns false. You need