Search code examples
sqlreporting-servicesreporting

Student seeking help for SSRS filter


I'm using SSRS. I'm trying to setup a filter that functions as a phone number search. If there is no phone number, it could be null and otherwise search entered phone number. I've attached my code below.

declare @phonein varchar (50)
set @phonein = ''

select d.MethodTitle, d.Active, d.ReferralMethodID, s.TollFreePhoneID, s.Phone, s.AdminModifyDateTime
from tReferralMethod as d
inner join tTollFreePhone
as s
on s.ReferralMethodID = d.ReferralMethodID

where s.phone = @phonein

I'm at a standstill at the last line, I think.


Solution

  • To find records with a null phone number using a null parameter value, use

    where (@phonein IS NULL and s.phone IS NULL) OR (s.phone = @phonein)