I'm having an issue forming a stored procedure for SQL Server where I want to use IN() function.
The statement would be something like:
Hardcoding works, but if I write a SP using a variable:
and call the variable with input:
I get nothing, even though I believe I've escaped the string correctly.
What I could be missing?
The statement would be something like:
Code:
SELECT a, b FROM foo WHERE a IN ('bar', 'baz');
Hardcoding works, but if I write a SP using a variable:
Code:
SELECT a, b FROM foo WHERE a IN (@var)
and call the variable with input:
Code:
@var = '''bar'', ''baz'''
I get nothing, even though I believe I've escaped the string correctly.
What I could be missing?