Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 filter multiple values

Author  Topic 

somenoob
Posting Yak Master

112 Posts

Posted - 2011-10-13 : 22:00:38
Hi everyone, i have a question to ask.



in the picture, it shows that the filters can only filter one value. e.g BT. is it possible for it to filter multiple values such as BT,KT,AT or something similar?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-14 : 00:59:57
yep. its possible. two ways to do that.
one way is to use WHERE condition like

WHERE ',' + @searchString +',' LIKE '%,' + Column + ',%'

other way is like

WHERE Column IN (SELECT Val FROM dbo.ParseValues(@searchstring,','))

where ParseValues is a string parsing udf given below

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -