0

Possible Duplicate:
How to delete all rows from all tables in a SQL Server database?

I want to delete all rows from a SQL Server 2005 database.

Can anyone to define a procedure to delete all rows from database by using single query?

Community
  • 1
  • 1
Umair Noor
  • 442
  • 4
  • 17

2 Answers2

0

In that case, this will work:

EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
GO
EXEC sp_MSForEachTable 'DELETE FROM ?'
GO
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
GO

thanks @MAT

Umair Noor
  • 442
  • 4
  • 17
-2

Have you tried : delete * FROM database.* ?

tinka
  • 1
  • 1