Link to home
Start Free TrialLog in
Avatar of mcrmg
mcrmg

asked on

SQL query wildcard

Hi,

I am trying to create a form that only takes one string and pass it to a sp, but this parameter will look into several fields. This is my code, it works for only one field. Any ideas?  thanks

Select DISTINCT 
	  F1, F2
From T1   
Where
	((@AnySearch is null) or (F1 LIKE '%' + @AnySearch + '%')) AND
	((@AnySearch is null) or (F2 LIKE '%' + @AnySearch + '%')) 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcrmg
mcrmg

ASKER

thank you