troubleshooting Question

Alter multiple tables in MySQL

Avatar of DanielAttard
DanielAttardFlag for Canada asked on
MySQL ServerSQL
2 Comments1 Solution986 ViewsLast Modified:
I use the following command to alter a single table in mydb:

ALTER TABLE mydb.Table1  ADD COLUMN `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP  AFTER `lastfield`;

I have about 80 tables where I need to add a timestamp column as the last field.  How would I alter this code so that I can add the timestamp to all tables?

Thanks,
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros