is this possible? stored procedures

dec21st

Active member
Joined
May 14, 2005
Messages
43
Programming Experience
3-5
hey, i need to know whether this is possible?

say i create a stored procedure to send in this parameters
-poid

and i have 2 table to manipulate
TABLE Restock has
-po
-item
-qty

TABLE Quantity has
-id
-qty

i wanna select part of the restock
select item from restock where po = @poid

then....

what i want to do is extract restock.qty and update it at quantity.qty
i wanna do something like quantity.qty = quantity.qty + restock.qty
where restock.item = quantity.id
all in a loop from 'select item from restock where po = @poid'

my idea is something like
VB.NET:
//send in @poid as param
 
select item from restock where po = @poid
 
loop
update quantity set qty = qty + restock.qty where id = restock.item
 
Easy....

VB.NET:
UPDATE Quantity
SET qty = qty + R.qty
FROM Quantity Q
INNER JOIN Restock R
  ON Q.ID = R.ITem
WHERE R.po = @poid

I think that will do it.... if I've read your code right...

Tg
 
yeah, thanks for the tips

i've got it fix edi... was blur til u told me that.. didn't thought of it. mind was blank i guess

*problem resolved
 
Back
Top