Parameter for an IN clause

  • Thread starter Thread starter Joe Thompson
  • Start date Start date
J

Joe Thompson

Hi,

I am using C# to write a windows app that uses a MS Access DB. I have a
query saved in Access (stored procedure) that has some parameters:

SELECT *
FROM Loans
WHERE (BranchName=[@bn] And DateFunded>=[@dfStart] And DateFunded<=[@dfStop]
And RepName IN ([@rns]));

My question is, how do I pass in a list of more than one name for @rns?

Something like ...RepName IN ('Eddie', 'Bill', 'Bob')...

Thank you,
Joe
 
Thanks for the info. It would be nice if it could be done...

Joe

Cor Ligthert said:
Hi Joe,

You simply cannot do that.

Cor


Joe Thompson said:
Hi,

I am using C# to write a windows app that uses a MS Access DB. I have a
query saved in Access (stored procedure) that has some parameters:

SELECT *
FROM Loans
WHERE (BranchName=[@bn] And DateFunded>=[@dfStart] And
DateFunded<=[@dfStop]
And RepName IN ([@rns]));

My question is, how do I pass in a list of more than one name for @rns?

Something like ...RepName IN ('Eddie', 'Bill', 'Bob')...

Thank you,
Joe
 
Hi Mark,

That's an interesting idea - thanks! Just out of curiosity, if it's not too
much work to explain, how would you do it in SQL Server?

Joe
 
There are several approaches to this problem in SQL Server including using
Table-type Parameters, CLR or TSQL routines that parse delimited strings
into Table variables and others.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________
 
Back
Top