SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: How to Batch Rename Tables?
-
Jan 3, 2009, 21:23 #1
- Join Date
- Oct 2005
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How to Batch Rename Tables?
I have a few Wordpress databases that need to have the tables renamed. I would like to make a script to batch process this.
Currently the databases have names like this:
wp_j1rry4_comments
wp_j1rry4_links
wp_j1rry4_options
wp_j1rry4_postmeta
wp_j1rry4_posts
wp_j1rry4_terms
wp_j1rry4_term_relationships
wp_j1rry4_term_taxonomy
wp_j1rry4_usermeta
wp_j1rry4_users
How could I change them to have their names like this:
wp_comments
wp_links
wp_options
wp_postmeta
wp_posts
wp_terms
wp_term_relationships
wp_term_taxonomy
wp_usermeta
wp_users
I found this webpage that does something similar but they are adding a prefix to the table name, I want to take characters away.
-
Jan 3, 2009, 21:33 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
Code:RENAME TABLE wp_j1rry4_comments TO wp_comments , wp_j1rry4_links TO wp_links , wp_j1rry4_options TO wp_options , wp_j1rry4_postmeta TO wp_postmeta , wp_j1rry4_posts TO wp_posts , wp_j1rry4_terms TO wp_terms , wp_j1rry4_term_relationships TO wp_term_relationships , wp_j1rry4_term_taxonomy TO wp_term_taxonomy , wp_j1rry4_usermeta TO wp_usermeta , wp_j1rry4_users TO wp_users ;
-
Jan 3, 2009, 21:47 #3
- Join Date
- Oct 2005
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks very much r937, you made it look easy
Bookmarks