declare @myParam int
set @myParam = 6 (or null)
select *
from entry
where
(entry.uid = @myParam OR @myParam is null)
No need to make the param zero. This worked as expected so that
when myparam = 6 it returned the single row
when myparam = null it returned all
when myparam = 666666666 it returned none. (an int not in the column)
On the face of it it looks more performant then the coalesce method. If I try some tests I will post the results.
Dave
Trainmark.com IT Training B2B Marketplace
(Jobs for IT Instructors)