Coalesce or IsNull can still work, since the variable/parameter will have no value assigned.
The problem with this method, or similar ones, is that it tends to kill performance because of non-SARGability of the query.
Dynamic SQL is often the best answer for this.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon