Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Fast way to delete all purchase orders and Carts

Vote:
 

A well defined sql structure (with cascade deleted) could have been helpfull here. I occasionally move my production database to development, mostly to have an updated catalog.

Page size: all --> Select all --> Deleted selected is just not possible with so many rows

#65809
Feb 11, 2013 12:17
Vote:
 

Btw: tried this http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=59346

Get the following exception:

The job failed: All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists. Iterating through meta classes Metaclass Table: OrderFormEx Metaclass Table: ShipmentEx Metaclass Table: LineItemEx Metaclass Table: OrderGroupAddressEx Metaclass Table: OrderFormPayment_CreditCard Metaclass Table: OrderFormPayment_CashCard Metaclass Table: OrderFormPayment_Invoice Metaclass Table: OrderFormPayment_GiftCard Metaclass Table: OrderFormPayment_Other Metaclass Table: OrderFormPayment_Exchange Metaclass Table: OrderGroup_PurchaseOrder Metaclass Table: OrderGroup_ShoppingCart Metaclass Table: OrderGroup_PaymentPlan Metaclass Table: CatalogNodeEx Metaclass Table: CatalogEntryEx Metaclass Table: CatalogEntryEx_RoseVariant Metaclass Table: CatalogEntryEx_FixedPackage Metaclass Table: CatalogEntryEx_StockItemVariant Metaclass Table: CatalogEntryEx_GenericProduct Metaclass Table: CatalogEntryEx_GenericVariant Metaclass Table: CatalogEntryEx_GiftCertificateProduct Metaclass Table: CatalogEntryEx_GiftCertificateVariant Metaclass Table: CatalogEntryEx_FuneralProduct Metaclass Table: CatalogEntryEx_AbroadProduct Metaclass Table: CatalogEntryEx_AbroadVariant

 

#65817
Feb 11, 2013 14:06
Vote:
 
<p>Ended up doing:<br /><br /></p> <pre class="brush:sql;auto-links:false;toolbar:false" contenteditable="false">DELETE FROM LineItem DELETE FROM Shipment DELETE FROM ShipmentEx DELETE FROM OrderFormPayment DELETE FROM OrderFormPayment_CashCard DELETE FROM OrderFormPayment_Invoice DELETE FROM OrderFormPayment_CreditCard DELETE FROM OrderFormPayment_Other DELETE FROM OrderGroupAddress DELETE FROM [dbo].OrderForm DELETE FROM [dbo].[OrderGroup] DELETE FROM OrderGroup_PurchaseOrder DELETE FROM OrderGroup_ShoppingCart DELETE FROM OrderGroupAddressEx DELETE FROM OrderGroupAddressEx_Localization DELETE FROM OrderFormEx</pre> <p></p> <p></p> <p>Sorry i edited the post and the i cannot seems to save it without the html being escaped!</p>
#65880
Edited, Feb 13, 2013 12:20
Vote:
 

Palle Mertz: You should clean away your customer name from that script for cleanliness, this answer ranks fairly high on Google. :-)

#151731
Aug 05, 2016 10:26
Vote:
 

Yeah good point Arve, thanks :)

Edited the post, but the post got useless. I think this forum html escapes everything when you save an edited post. So i copy / pasted it here as well:

DELETE FROM LineItem
DELETE FROM Shipment
DELETE FROM ShipmentEx
DELETE FROM OrderFormPayment
DELETE FROM OrderFormPayment_CashCard
DELETE FROM OrderFormPayment_Invoice
DELETE FROM OrderFormPayment_CreditCard
DELETE FROM OrderFormPayment_Other
DELETE FROM OrderGroupAddress
DELETE FROM [dbo].OrderForm
DELETE FROM [dbo].[OrderGroup]
DELETE FROM OrderGroup_PurchaseOrder
DELETE FROM OrderGroup_ShoppingCart
DELETE FROM OrderGroupAddressEx
DELETE FROM OrderGroupAddressEx_Localization
DELETE FROM OrderFormEx



#152025
Edited, Aug 12, 2016 17:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.