Looping In Stored Procedure

Results 1 to 2 of 2

Thread: Looping In Stored Procedure

  1. #1
    Join Date
    Dec 1969

    Default Looping In Stored Procedure

    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 -<BR><BR>Select itemID FROM tblOrders WHERE orderID=WHATEVER<BR><BR>while(The previous select NOT EOF)<BR>update tblInventory WHERE itemID=itemID<BR>wend<BR><BR>I need to do all of this in a Stored Procedure though? Possible?

  2. #2
    Join Date
    Dec 1969

    Default No need for a loop

    update tblInventory <BR> set abel = &#039;Lost Horizon&#039;<BR>WHERE itemID in (Select itemID FROM tblOrders <BR> WHERE orderID=4711)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts