|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, February 16, 2005 10:13 AM
Points: 4,
Visits: 1
|
|
Sorry, I should use this instead of my last post:
CREATE PROCEDURE sp_MySearch @p1 varchar(50), @p2 varchar(50) As
select * from t where isnull(c1, isnull(@p1,'')) like case when len(isnull(@p1,'')) =0 then isnull(c1, '') else '%'+@p1+'%' end and isnull(c2, isnull(@p2,'')) like case when len(isnull(@p2,'')) =0 then isnull(c2, '') else '%'+@p2+'%' end
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, November 14, 2012 12:06 PM
Points: 15,
Visits: 131
|
|
Hi Leon, Great article. I thnk even this solution would work: IsNull(state,'') like IsNull(@State,'') Or state like IsNull(@state,state)+''I am using this in a procedure and it seems to work fine.
|
|
|
|