HKFuey
asked on
SQL 2005 Stored Procedure
I have a SP that Picks Sales O)rder lines and updates the stock with Qty Picked.
If the user picks more than the available stock it then goes negative. Is there an eay way to just set StockQty to zero?
If the user picks more than the available stock it then goes negative. Is there an eay way to just set StockQty to zero?
If @PickType = 'PickMan'
Begin
Update OrderDetail Set QtyPicked = @PickQty, Pickedby = @pUser, DatePicked = GETDATE ( )
Where OrderNo = @OrderNo and Barcode = @Bcode
set @iMsg = 'Picked ordered qty for ' + @Bcode
-- update the stock qty
Update Stock Set StockQty = StockQty - isnull((@PickQty),0),
QtyReserved = QtyReserved - isnull((@PickQty),0)
Where Barcode = @Bcode
goto ShowResults
End
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER