Re: conditional logic in stored procedure Hi Jason,
Here's one suggestion. Change your params to '%' if they're null.
That way you don't need the IF statement. I would also rewrite the
"not like" clause as it's CPU intensive. - Louis
select @ins1=isnull(@ins1,'%')
select @ins2=isnull(@ins2,'%')
select @ins3=isnull(@ins3,'%')
SELECT * from ikb where
ikbtitle like @ins1 and
ikbtitle like @ins2 and
ikbtitle not like @ins3 and
ikbbody like @ins1 and
ikbbody like @ins2 and
ikbbody not like @ins3 |