Hi Guys,
Just wonder is there are any SQL script which can delete All the products and categories in one go ?
Regards
Dylon
Hi Guys,
Just wonder is there are any SQL script which can delete All the products and categories in one go ?
Regards
Dylon
This should clear-out everything product related.
BEGIN TRANSACTION;
BEGIN TRY
DECLARE @ErrorMessage NVARCHAR(MAX);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
DELETE FROM dbo.ScreenMenuItems;
DELETE FROM dbo.ScreenMenuCategories;
DELETE FROM dbo.RecipeItems;
DELETE FROM dbo.Recipes;
DELETE FROM dbo.MenuItemPrices;
DELETE FROM dbo.MenuItemPriceDefinitions;
DELETE FROM dbo.MenuItems;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRANSACTION;
SET @ErrorMessage = ERROR_MESSAGE();
SET @ErrorSeverity = ERROR_SEVERITY();
SET @ErrorState = ERROR_STATE();
RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
END;
END CATCH;