cthulhu (owner)

Revisions

gist: 114109 Download_button fork
public
Public Clone URL: git://gist.github.com/114109.git
Embed All Files: show embed
DROP all tables from DB #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
delimiter $$
 
DROP PROCEDURE IF exist drop_tables();
 
create procedure drop_tables()
begin
  SELECT
    @drop_sql:=concat('DROP TABLE IF EXISTS ', group_concat(table_name))
    drop_statement
  FROM information_schema.tables
  WHERE table_schema=database();
  IF (@drop_sql IS NOT NULL) THEN
    PREPARE stmt from @drop_sql;
    EXECUTE stmt;
    DROP PREPARE stmt;
  END IF;
end$$
delimiter ;