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 |
gsm113
Starting Member
1 Post |
Posted - 2012-11-08 : 19:01:38
|
Hi all,I would like to run a set of SQL code on a repeat loop, with each loop using a different value for a specific parameter.In other words, I have a data set (X,Y,Z) and I want to run the code passing X as a variable, using Y, and then again using Z. If anyone can get me started down the right path I would greatly appreciate it. |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2012-11-09 : 02:58:56
|
DECLARE @i INTSET @i = 1 WHILE @i <=3BEGINIF @i = 1 EXEC myProc 'X'ELSE IF @i = 2 EXEC myproc 'Y'ELSE IF @i = 3 EXEC myProc 'Z'SET @i = @i + 1END-Chad |
|
|
|
|
|