View Single Post

   
  #2 (permalink)  
Old 02-29-2008, 01:56 PM
ZeldorBlat
 
Posts: n/a
Default Re: Creating WHERE clauses based on IF (or CASE) STATEMENTS Transact-SQL

How about this:

if @myparam = '' or @myparam is null
@myparam = '%'
else
@myparam = '%' + @myparam + '%'

select ...
from mytable
where MyField like @myparam

Reply With Quote