I often find myself with 3 or 4 purchase orders for the same delivery. Is there a quick way to merge them all into one for better review ond processing?
Merging Multiple Purchase Orders
Sep 07, 2006
2 Replies
Please run the sql statement
**********************************************--please specify the ponumber of order u want to keep in @MasterPONo variable
--please specify the ponumber of order u want to rmmove in @AddxPONo variable
declare @MasterPONo varchar(20) declare @Add1PONo varchar(20) declare @Add2PONo varchar(20) declare @Add3PONo varchar(20) declare @MasterPOID int
set @MasterPONo='' --PUT ponumber here set @Add1PONo='' --PUT ponumber here set @Add2PONo='' --PUT ponumber here set @Add3PONo='' --PUT ponumber here
select @MasterPOID=ID from purchaseorder where ponumber=@MasterPONo
update purchaseorderentry set PurchaseOrderID=@MasterPONo from purchaseorder where purchaseorder.id=purchaseorderentry.purchaseorderid and (ponumber=@Add1PONo or ponumber=@Add2PONo or ponumber=@Add2PONo)
--Optional
--to delete the empty orders
/*delete purchaseorder where ponumber=@Add1PONo or ponumber=@Add2PONo or ponumber=@Add2PONo*/
******************************************"Lance" wrote:
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required