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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Looping Through a Recordset in a Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-08 : 09:36:58
Nick writes "I have a problem where I need to loop through a table or recordset in a stored procedure using SQL Server 2000. Is this possible? For example I would like to get a list of items on a particular order. I then need to update these items in another table.. So basically I want to -

Select itemID FROM tblOrders WHERE orderID=WHATEVER

while(The previous select NOT EOF)
update tblInventory WHERE itemID=itemID
wend

I need to do all of this in a Stored Procedure though? Possible?"
   

- Advertisement -