Run below query to delete all records from all tables:
EXEC sp_MSforeachtable @command1 = “DELETE FROM ?”
EXEC sp_MSforeachtable @command1 = “TRUNCATE TABLE ?”
We cannot delete data from all tables if there are foreign key references. To resolve this we have to disable all constraint than run the above query. To disable all constraint run below query:
EXEC sp_MSForEachTable ‘ALTER TABLE ? NOCHECK CONSTRAINT ALL’
Now run the query to delete data.