Generating MySQL Qeuries

mysql > SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES;
......
2270 rows in set (0.01 sec)

OMFG! WTF?! What have I done??
For a moment I thought I just accidentally truncates 34 databases and 2270 tables. Phew, luckily is just some string output to the console. No databases, tables, and records were harmed.

No comments:

Post a Comment