Skip to content

Instantly share code, notes, and snippets.

@jamescoxhead
Created January 11, 2016 09:55
Show Gist options
  • Save jamescoxhead/8588d9442a2ddb765e82 to your computer and use it in GitHub Desktop.
Save jamescoxhead/8588d9442a2ddb765e82 to your computer and use it in GitHub Desktop.
Hard deletes a uCommerce product. When a product is deleted from the back office it is only soft deleted, there is no way to hard-delete a product from the back office.
BEGIN TRANSACTION
BEGIN TRY
DECLARE @ProductId int;
SET @ProductId = 142;
DELETE FROM uCommerce_PriceGroupPrice
where ProductId = @ProductId
DELETE FROM uCommerce_ProductRelation
where ProductId = @ProductId
DELETE FROM uCommerce_CategoryProductRelation
where ProductId = @ProductId
DELETE FROM uCommerce_ProductProperty
where ProductId = @ProductId
DELETE FROM uCommerce_ProductDescription
where ProductId = @ProductId
DELETE FROM uCommerce_Product
where ProductId = @ProductId
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
END CATCH
IF @@TRANCOUNT > 0
COMMIT TRANSACTION
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment