I'm trying to query a table of about 120,000 records using OPENQUERY. We will call the table "Person". For this table, there are multiple statuses, such as, "Active", "Discharged", "Resigned", etc. I have a parameter, @status, which is a multi-value parameter and needs to be passed to the OPENQUERY, so I can limit the amount of records coming into the dataset. Here's an example of what I'm looking for:
SELECT * FROM OPENQUERY(DATA_WAREHOUSE,'SELECT PersonID, EmploymentStatus FROM dbo.Employee WHERE EmploymentStatus IN [@Status parameter goes here...]')
I have tried the following (after reading some other forum entries) which have not worked:
...IN '''@Status'''')
...IN ''' + @status'''')
...IN ''' + @status + '''')