VegaS1234

[SQL] Truncate multiple tables

Jun 20th, 2017
1,481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.34 KB | None | 0 0
  1. +-----------------------------------------------------+
  2. |               RETURN STRING SQL COMMAND             |
  3. +-----------------------------------------------------+
  4. SELECT CONCAT('TRUNCATE table ', TABLE_NAME, ';')
  5. FROM information_schema.TABLES
  6. WHERE TABLE_NAME IN (
  7.     'player',
  8.     'player_index',
  9.     'player_deleted',
  10.     'guild',
  11.     'guild_war',
  12.     'guild_grade',
  13.     'guild_member',
  14.     'guild_comment',
  15.     'guild_war_bet',
  16.     'guild_war_reservation',
  17.     'item',
  18.     'marriage',
  19.     'horse_name',
  20.     'dragonsoul_items',
  21.     'change_empire',
  22.     'affect'
  23. );
  24.  
  25. +-----------------------------------------------------+
  26. |               DIRECT SQL COMMAND                    |
  27. +-----------------------------------------------------+
  28. TRUNCATE TABLE player.player;
  29. TRUNCATE TABLE player.player_index;
  30. TRUNCATE TABLE player.player_deleted;
  31. TRUNCATE TABLE player.guild;
  32. TRUNCATE TABLE player.guild_war;
  33. TRUNCATE TABLE player.guild_grade;
  34. TRUNCATE TABLE player.guild_member;
  35. TRUNCATE TABLE player.guild_comment;
  36. TRUNCATE TABLE player.guild_war_bet;
  37. TRUNCATE TABLE player.guild_war_reservation;
  38. TRUNCATE TABLE player.marriage;
  39. TRUNCATE TABLE player.item;
  40. TRUNCATE TABLE player.quest;    
  41. TRUNCATE TABLE player.messenger_list;
  42. TRUNCATE TABLE player.horse_name;    
  43. TRUNCATE TABLE player.dragonsoul_items;
  44. TRUNCATE TABLE player.change_empire;  
  45. TRUNCATE TABLE player.affect;
  46. TRUNCATE TABLE account.account;
Advertisement
Add Comment
Please, Sign In to add comment