Try this code
declare @chargeCust varchar(50)
set @chargeCust = 'test001'
select top 5
dj.job_no
, dj.cust_cd
, dj.job_date_time
, dj.dlv_reqd_datetime_last
from daily_job dj
where
dj.job_date_time >getdate-7 and
((len(@chargeCust) > 0 and dj.cust_cd in (@chargeCust)) or (len(@chargeCust) = 0...