Merging Multiple Purchase Orders

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?

Reply to
Lance
Loading thread data ...

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:

Reply to
Nashat

Reply to
Nashat

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.