I am stuck on what is probably a simple thing, but can't figure it out.
I have the query below which gives me the results I want - two records are returned.
SELECT *
FROM tbl_BudgetScenario
WHERE Name IN ('Sewer Pipes for 100 Years',
'Sanitary Pipe - $5M for 50 Years')
However, if I place the IN statement parameters into a variable (which I need to do for the code I am working on), I don't get any results.
DECLARE @Scenarios VARCHAR(MAX)
SET @Scenarios = '''Sewer Pipes for 100 Years''' + ','+ '''Sanitary Pipe - $5M for 50 Years'''
SELECT *
FROM tbl_BudgetScenario
WHERE Name IN (@Scenarios)
It isn't obvious to me why this wouldn't work. Hoping someone can explain and/or provide a potential workaround.