I’m debating whether or not to try running through a list of tables and truncating them with a stored procedure. Would it be that easy with MySql and how would I do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The main piece of info you need is the list of tables. Most platforms support this:
However, before you code the sproc, do a select * from information_schema.tables and examine the entries, there may be some you do not expect — system tables and such, so you may need to craft a filter to get the set you want.
Since I don’t do mySQL that much, I can’t show you the code, but if you can translate this from MS SQL, and fill in some blanks you can make it work: