Monday, March 12, 2012

passing a 'In expression' to Stored procedure

Are there a way to pass a expression as a parameter of a stored procedure?
I am writing a stored procedure,
There is a Select statement something like:
Select Name, Street, City, State from CustomerAddress where state in
('MN','CA','TN')
Are there a way passing "('MN','CA','TN')" as parameter to the stored
Procedure?
ThanksHere is a solution.
Arrays and Lists in SQL Server
http://www.sommarskog.se/arrays-in-sql.html
AMB
"M" wrote:

> Are there a way to pass a expression as a parameter of a stored procedure?
> I am writing a stored procedure,
> There is a Select statement something like:
> Select Name, Street, City, State from CustomerAddress where state in
> ('MN','CA','TN')
> Are there a way passing "('MN','CA','TN')" as parameter to the stored
> Procedure?
> Thanks
>
>|||On Thu, 11 May 2006 11:54:55 -0700, M wrote:

>Are there a way to pass a expression as a parameter of a stored procedure?
>I am writing a stored procedure,
>There is a Select statement something like:
>Select Name, Street, City, State from CustomerAddress where state in
>('MN','CA','TN')
>Are there a way passing "('MN','CA','TN')" as parameter to the stored
>Procedure?
Hi M,
http://www.sommarskog.se/arrays-in-sql.html
Hugo Kornelis, SQL Server MVP

No comments:

Post a Comment