Thread
:
Creating WHERE clauses based on IF (or CASE) STATEMENTS Transact-SQL
View Single Post
#
2
(
permalink
)
02-29-2008, 01:56 PM
ZeldorBlat
Posts: n/a
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
ZeldorBlat