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 |
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2014-07-09 : 12:06:33
|
I have a stored procedure that accepts the following parameter:@SelSyms NVARCHAR(1500) = NULL AS....I am passing into the SP the following values, and assigning to a variable that will be used later in a where condition:100 200 abc 12abcHow can I use the parameter within a WHERE IN(...) clause?I can can't get the formatting correct for multiple values.DECLARE @SELTRIM VARCHAR(1500), @SELRESTR VARCHAR(1500);SET @SELTRIM = RTRIM(@SelSyms)SET @SELRESTR = REPLACE(@SELTRIM, ' ', ''',') SELECT * FROM TABLE AND COLUMN_A IN (@SELRESTR) |
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2014-07-09 : 12:14:39
|
Should have said:SELECT * FROM TABLE WHERE COLUMN_A IN (@SELRESTR) |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2014-07-10 : 13:28:18
|
Split the string into a keyed, clustered temp table, then join to that table. |
|
|
|
|
|