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.
Author |
Topic |
KY
Starting Member
1 Post |
Posted - 2008-06-01 : 07:01:34
|
Is anybody here knowing how to create a dynamic query based on a multi-value parameter? e.g. there is a multi-value report parameter called names. For a static query, the where clause of a select statement likes the following select * from students where name=@names For the dynamic one, I tried something like the below, but it did not work. ="select * from students where name=(" & Join(Parameters!names ,',') & ")" Any suggestion would be great appreciated. Thanks, KY |
|
Will Riley
Starting Member
10 Posts |
Posted - 2008-06-01 : 12:45:25
|
Try WHERE Name INas opposed to WHERE Name =Cheers,Will |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-01 : 14:59:21
|
quote: Originally posted by KY Is anybody here knowing how to create a dynamic query based on a multi-value parameter? e.g. there is a multi-value report parameter called names. For a static query, the where clause of a select statement likes the following select * from students where name=@names For the dynamic one, I tried something like the below, but it did not work. ="select * from students where name=(" & Join(Parameters!names ,',') & ")" Any suggestion would be great appreciated. Thanks, KY
May be thisselect * from students where ','+ Join(Parameters!names ,',')+',' LIKE '%,' + name + ',%' |
 |
|
|
|
|
|
|