philosinger
MIS
Background I am executing this from an application where the user selects the states that they want to have moved.
Problem/Question
Is is possible to execute a stored procedure with a list as the parameter. Here is the storedProcedure I am trying to run
CREATE PROCEDURE [sp_mysp] @StateAbbr varchar(255) AS
select State, sum(col1) as col1, sum(col2) as col2
into NewTable
from OldTable
where State in (@StateAbbr)
group by State
order by State
I try to execute:
sp_mysp 'VA', 'MD', 'CA'
however I get an error stating that I am providing to many parameters.
What should my data type be? Can I even do this?
Problem/Question
Is is possible to execute a stored procedure with a list as the parameter. Here is the storedProcedure I am trying to run
CREATE PROCEDURE [sp_mysp] @StateAbbr varchar(255) AS
select State, sum(col1) as col1, sum(col2) as col2
into NewTable
from OldTable
where State in (@StateAbbr)
group by State
order by State
I try to execute:
sp_mysp 'VA', 'MD', 'CA'
however I get an error stating that I am providing to many parameters.
What should my data type be? Can I even do this?