I have the following SQL:SELECT jobtran.Trans_Date , job.job + '-' + cast(job.suffix as varchar) as Job , job.item , jobtran.wc , (SELECT description FROM WC WHERE wc = jobtran.wc) AS WC_Description , jobtran.Reason_Code , reason.Description , jobtran.Qty_Scrapped , item.Unit_Cost FROM jobtran inner join job on jobtran.job = job.job and jobtran.suffix = job.suffix inner join item on job.item = item.item left outer join reason on jobtran.reason_code = reason.reason_code and reason_class = 'MFG SCRAP'WHERE (jobtran.trans_date BETWEEN @PStartingJobDate AND @PEndingJobDate) AND jobtran.qty_scrapped > 0 AND CHARINDEX(job.stat, @PJobStatus) <> 0ORDER BY jobtran.trans_date, job.job, job.suffix
I would like to add the following to the where clause:jobtran.wc between @wcstart and @wcendBut if @wcstart and @wcend are both null I want it to disregard this part of the where clause. Is there a way to do that?