I'm building a WHERE clause that uses the IN keyword like: IN (100, 104, -45). where the values are numeric.
I've declared a variable, like: DECLARE @HOMEIDS varchar(50);
Then I set it like: SET @HOMEIDS = '-100, -101';
I want in effect, IN (@HOMEIDS), but doing this get me an error: Error converting data type varchar to bigint.
How can I fix this?