Passing multiple string selection to Store Procedure

P

Paul

Hi,

I'm try to pass a string to a variable in SQL Server, and
have that string used with "IN" clause to return multiple
results. This doesn't work. Can anybody help?

DECLARE @in_codes varchar(100)
Set @in_codes = char(34) + 'QFSWPA' + char(34) + ', ' +
char(34) + 'QFSWTR' + char(34)

SELECT COUNT(Certificate_Code) AS TotalInDomain
FROM OLCReports.RPDocentDataMart_User
WHERE Certificate_Code In (SELECT Certificate_Code
FROM OLCReports.RPDocentDataMart_User
WHERE (Certificate_Code IN (@in_codes))
GROUP BY Certificate_Code, userID)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top