
SET @SQL_SAFE_UPDATES=@@SQL_SAFE_UPDATES;
SET SQL_SAFE_UPDATES=0;

DELETE FROM `bim_dwh_orders_in_dataset` where dataset_id = @dataset_id;

DELETE FROM `sn_dim_age` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_attribute_option` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_address_details` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_billing_address` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_category` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_customer` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_customer_mini` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_order_date` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_invoice_date` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_order_state` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_order_time` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_payment_method` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_product` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_salesrule` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_shipping_address` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_shipping_method` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_store` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_tax_rate` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_comment` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_credit_memo` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_credit_memo_item` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_credit_memo_item_parent` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_invoice` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_invoice_item` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_invoice_item_parent` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_metadata` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order_cancel` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order_cancel_item` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order_cancel_item_parent` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order_item` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order_item_parent` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_order_status_updates` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_payment` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_shipment` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_shipment_item` where dataset_id = @dataset_id;
DELETE FROM `sn_fact_shipment_item_parent` where dataset_id = @dataset_id;
DELETE FROM `sn_map_order_item_tax_rate` where dataset_id = @dataset_id;
DELETE FROM `sn_map_order_state` where dataset_id = @dataset_id;
DELETE FROM `sn_map_order_tax_rate` where dataset_id = @dataset_id;
DELETE FROM `sn_map_product_attribute` where dataset_id = @dataset_id;
DELETE FROM `sn_map_product_category` where dataset_id = @dataset_id;
DELETE FROM `sn_map_salesrule` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_default_billing_address` where dataset_id = @dataset_id;
DELETE FROM `sn_dim_default_shipping_address` where dataset_id = @dataset_id;
SET SQL_SAFE_UPDATES = @SQL_SAFE_UPDATES;