Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2013-12-10 : 15:44:28
|
Hi,I have a stored procedure which i can't alter that takes several inputs. I need to run it x number of times on a certain table. How can i execute the sp multiple times and each time with different parameters?I also need to save the output for each idno in a temp table as i need to use that information again.DECLARE @RC intDECLARE @IdNo intDECLARE @StartDate datetimeDECLARE @Plan smallintDECLARE @UserNo int-- TODO: Set parameter values here.EXECUTE @RC = [sp_CreatePackage] @IdNo ,@StartDate ,@Plan ,@UserNoGOThanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2013-12-10 : 15:59:07
|
You would use a WHILE loop or a cursor.Where will you get the parameter values from?Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2013-12-11 : 01:13:23
|
Thanks. I will get the parameters from a table. |
|
|
|
|
|