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 |
|
kloepper
Yak Posting Veteran
77 Posts |
Posted - 2006-03-03 : 16:48:47
|
| I'm having trouble getting an IN clause to work. When I use a variable to feed the criteria to the clause, the IN fails (no rows affected). The variable is constructed with a string builder and looks exactly like the string that works, eg, @symbols = 'adrx', 'aes' .WHERE (a_Name_Symbol.Symbol IN ('adrx', 'aes')) //This worksWHERE (a_Name_Symbol.Symbol IN (@Symbols)) //This failsIs there something obvious that I'm doing wrong here?Paul |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-03-03 : 17:13:28
|
| That form of an IN select list is not allowed. You can use dynamic SQL, or you can insert the values into a temp table and use a subquery select in the IN.CODO ERGO SUM |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-03-03 : 17:14:34
|
| http://www.sqlteam.com/item.asp?ItemID=11499Tara Kizeraka tduggan |
 |
|
|
kloepper
Yak Posting Veteran
77 Posts |
Posted - 2006-03-03 : 17:33:21
|
Tara:Thank you for that answer Paul===============================================quote: Originally posted by tkizer http://www.sqlteam.com/item.asp?ItemID=11499Tara Kizeraka tduggan
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|