[dba-SQLServer] passing IN search condition to stored procedure

Eric Barro ebarro at afsweb.com
Thu Apr 8 16:56:05 CDT 2004


Greetings SQL gurus!

I have a .NET page that declares parameters for passing to a stored procedure with the code fragment...

myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.Add(New SqlParameter("@CustCode", SqlDbType.varchar, 255)).Value = strCustCode

On the stored procedure I have this...

SELECT * FROM table
WHERE [CustCode] IN (@CustCode)

with @CustCode defined as a parameter.

I can't get it to work...has anyone passed a bunch of values to a stored proc with an IN search condition and gotten it to work?

strCustCode would be equal to ('CUST01', 'CUST02', 'CUST03')

---
Eric Barro
Senior Systems Analyst
Advanced Field Services
(208) 772-7060
http://www.afsweb.com 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 4/8/2004





More information about the dba-SQLServer mailing list