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)
 Stored Procedure Help - 2!

Author  Topic 

pizzojm
Starting Member

20 Posts

Posted - 2001-10-08 : 09:51:07
Ok Sorry if my first question was misleading. I know how to call the stored procedure from said ASP pages, I just need help with the actual writing of the stored procedure itself! Here is the code I want to convert to a stored procedure:

'********

SQL3="SELECT distinct * FROM tblOrders_Products WHERE orderID=" & request.form("orderID")
set RS3 = connection.execute(SQL3)

While NOT RS3.EOF

SQL2="SELECT * FROM tblOrders_Products WHERE orderID=" & request.form("orderID") & " AND itemID='" & RS3.Fields("itemID") & "'"

set RS2 = connection.execute(SQL2)

addValue = CInt(RS2.Fields("opQty"))-CInt(request.form(RS3.Fields("itemID")))

SQL4="UPDATE tblOrders_Products SET opQty = " & request.form(RS3.Fields("itemID")) & " WHERE orderID=" & request.form("orderID") & " AND itemID='" & RS3.Fields("itemID") & "'"

SQL5="UPDATE tblInventory SET itemQty = itemQty + " & addValue & " WHERE itemID='" & RS3.Fields("itemID") & "'"

connection.execute(SQL4)
connection.execute(SQL5)

RS3.MoveNext
Wend

'********

Once again, this takes a product and lets a user update the information of an already placed order. Any information on how to write this code as a stored Procedure using SQL Server 2000 would be of great aprreciation! Thanks

   

- Advertisement -