Posts Tagged ‘Data’

Delete All Data From Your DataBase SQL

Here is a simple and efficient code to empty DataBase from data, using one of the non documented SQL functions “sp_MSFOREACHTABLE”. Using This code CREATE PROCEDURE dbo.[sp_DeleteAllData] AS EXEC sp_MSForEachTable ‘ALTER TABLE ? NOCHECK CONSTRAINT ALL’ EXEC sp_MSForEachTable ‘ALTER TABLE ? DISABLE TRIGGER ALL’ EXEC sp_MSForEachTable ‘DELETE FROM ?’ EXEC sp_MSForEachTable ‘ALTER TABLE ? CHECK […]

More »