• SQL is a declarative language, so a delimited list stored in a variable won't be evaluated. In short, I believe there are two ways of accomplishing this.

    The first approach uses dynamic SQL. Build you SQL statement and then execute it. Here's an example:

    declare @Var varchar(100),

    @strSQL NVarchar(500);

    set @Var = '''Value1'', ''Value2''';

    SET @strSQL = 'SELECT * ' +

    'FROM MainQuery ' +

    'WHERE column1 IN (' + @Var + ');';

    EXECUTE sp_executesql @strSQL;

    In the other appoach you would create a temp table (let's call it #temp) and populate it with the values you want to check for. Then use normal SQL and query them using an EXISTS against the temp table. here's an example:

    SELECT *

    FROM MainQuery

    WHERE EXISTS (SELECT 1

    FROM #temp

    WHERE #temp.Value = MainQuery.Column1);

    Hope one of these ways works for you.