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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-13 : 08:10:13
|
| Nik writes "I am novice in SQL Server. We have an existing VB/Access application and we'd like to move as many of the queries in the code as stored procedures. Here is my difficulty: we often have a list of args that we simply append to the sql string in VB. These args are a dynamically created list of keys (int) that are supplied to the IN clause in the SELECT statement. How can I parse this Varchar list to separate int arguments and supply them to the sql statement in the SP?I know that the workaround would be to create a temp table with these arguments and join it with the ordinary statement. That approach would kill my performance.Thank you very much for your help!Nik" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-01-13 : 08:13:27
|
quote: I know that the workaround would be to create a temp table with these arguments and join it with the ordinary statement. That approach would kill my performance.
What makes you think that? Have you tested it? |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-01-13 : 08:25:23
|
I would wonder why you think joining a table would kill your performance... but the another option would be to use your csv list as suchDeclare @csvList varchar(100)Set @csvList = '1,3,5,7,9'Select * from <yourTable>Where (','+@csvList+',') like (','+convert(varchar,<idColumn>)+',')Corey |
 |
|
|
|
|
|