0

Possible Duplicate:
Truncate all tables in a MySQL database in one command?

how to delete all the data from all tables in the database.

Community
  • 1
  • 1
Yajuvendra Vant
  • 1,127
  • 4
  • 15
  • 33

3 Answers3

0

use like this,

TRUNCATE `table1`;
TRUNCATE `table2`;
TRUNCATE `table3`;
TRUNCATE `table4`;
Karthik
  • 3,221
  • 5
  • 28
  • 38
0

If you have scripted creation of empty tables, it may be faster to drop and recreate the database, depending on number of tables. It is less typing for sure :-) -

Miro A.
  • 7,633
  • 2
  • 24
  • 21
0

You have to do it in single statements. You could create a loop, assigning the next table name to a variable and then use dynamic sql to execute the TRUNCATE statement.

Neil Knight
  • 47,437
  • 25
  • 129
  • 188