Passing multiple string selection to Store Procedure

  • Thread starter Thread starter Paul
  • Start date Start date
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)
 
Back
Top