File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes MySQL: delete all contents in the db Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "MySQL: delete all contents in the db" Watch "MySQL: delete all contents in the db" New topic
Author

MySQL: delete all contents in the db

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
does anyone know of any command that clear/delete/remove all the content in the dataase (but do not touch the tables) so the end result will be empty tables.

thanks
peter
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

In Oracle I use to genrate the script with help of a query.
you will have to write script using truncate

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
can you show an example of a script you wrote.
thanks
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

As I mentioned I did same in Oracle

Select TABLE_NAME form user_tables gives me all table in schema


so I made a query like


select distinct 'Truncate table ' || TABLE_NAME || ';' from USER_TABLES;
and I saved the output of query in a sql file

Then I could execute sql file on sql plus

Shailesh
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
see this


java amateur
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MySQL: delete all contents in the db
 
Similar Threads
deleting huge database
Node_table.......
Number of tables in a database
how to decide how many entity beans to have
delete from select query