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 |
RegTyler
Starting Member
11 Posts |
Posted - 2007-02-21 : 07:23:16
|
I have a sql server resultset that returns productid numbers. I would like to loop thru this resultset and run a stored procedure using the productid as the input parameter. Any samples would be helpful. thanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-21 : 07:36:55
|
create table #stage (ProductID INT)INSERT #StageEXEC uspMySPDECLARE @MinPID INT, @MaxPID INTSELECT @MinPID = MIN(ProductID), @MaxPID = MAX(ProductID)FROM #StageWHILE @MinPID <= @MaxPIDBEGINEXEC MyOtherSP @MinPIDSELECT @MinPID = MIN(ProductID)FROM #StageWHERE ProductID > @MinPIDENDPeter LarssonHelsingborg, Sweden |
|
|
RegTyler
Starting Member
11 Posts |
Posted - 2007-02-22 : 08:45:48
|
Thanks very much! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-22 : 09:33:36
|
Hereafter avoid posting in this forum. This forum is for working scripts only.There are other forums more suitable for these kind of questions.Peter LarssonHelsingborg, Sweden |
|
|
|
|
|