I am running a query with couple of bind variables in.
select isnull(w.assetno, w.pm_grp) assetno,
w.assetshortdesc,
w.assetlocn,
case when w.route_id is not null then ‘R’ when w.task_id is not null then ‘T’ when w.pm_idno is not null then ‘P’ else ‘C’ end as woType
FROM wkaw w
LEFT OUTER JOIN ast a ON w.assetno = a.assetno
LEFT OUTER JOIN wkpm m ON m.pm_idno = w.pm_idno
WHERE DATEDIFF(day,w.ORG_date, GETDATE()) between 0 and :daysCount --w.sc_date >= GETDATE() - :daysCount
AND (w.work_area = CASE WHEN :woWorkArea is null THEN w.work_area ELSE :woWorkArea END)
AND (m.status = CASE WHEN :pmStatus is null THEN m.status ELSE :pmStatus END)
AND (w.status = CASE WHEN :woStatus is null THEN w.status ELSE :woStatus END)
I get the bind variable window to appear and run the query with the appropriate data.
I then want to re run the query but setting one of the variables to null, if I delete the text in the box, it does not get set to null and sees {null} as a value
I just can’t figure how to do it.
I know I missing something somewhere, just been looking too long.
There is a workaround to set the var back to null: change the Type to another type and press OK. The next time you execute the SQL again, the Type will be restored
to the correct one and the value is back to null.