List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:February 22 2007 4:54pm
Subject:Re: Duplicating contents of DB within same DB with different prefix
View as plain text  
This should do what you are asking for (not that I approve of your
linguistic appraoch ;-))


CREATE TABLE PREFIX_pt_table1 LIKE pt_table1;
INSERT INTO PREFIX_pt_table1 SELECT * from pt_table1;


On 2/22/07, Istvan Hubay Cebrian <ihc.pub@stripped> wrote:
>
> Hi everyone,
>
> I revert to this mailing list to ask for help accomplishing a specific task.
> I'll try to explain as best I can.
>
> Say I have a DB named... well... "database1", this db has the following
> tables:
>
> pt_table1
> pt_table2
> pt_table3
>
> What I want to do is copy each of the tables (exactly as they are, including
> primary keys, data, etc) but at the same time change the prefix to something
> else (ie: eng_) so that I would end up with:
>
> pt_table1
> pt_table2
> pt_table3
> en_table1 (exact copy of pt_table1, including data PK, FK, etc..)
> en_table2 (exact copy of pt_table2, including data PK, FK, etc..)
> en_table3 (exact copy of pt_table3, including data PK, FK, etc..)
>
> Anyway of accomplishing this? Ideally without having to state each of the
> tables names. And also that this would work so that you could only duplicate
> tables that have a certain prefix, so: duplicate only tables that start with
> "pt_" and change prefix to "es_" for example.
>
> Any help or point in the right direction will be much apreciated!
>
> Thanks,
> Istvan Cebrian
>
> --
> View this message in context:
> http://www.nabble.com/Duplicating-contents-of-DB-within-same-DB-with-different-prefix-tf3272642.html#a9099573
> Sent from the MySQL - General mailing list archive at Nabble.com.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>


-- 
 - michael dykman
 - mdykman@stripped
Thread
Duplicating contents of DB within same DB with different prefixIstvan Hubay Cebrian22 Feb
  • Re: Duplicating contents of DB within same DB with different prefixChris McKeever22 Feb
    • Re: [Fwd: search issue] Duplicating contents of DB within same DBwith different prefixIstvan Hubay Cebrian22 Feb
  • Re: Duplicating contents of DB within same DB with different prefixMartijn Tonies22 Feb
    • Re: [Fwd: search issue] Duplicating contents of DB within same DBwith different prefixIstvan Hubay Cebrian22 Feb
  • Re: [Fwd: search issue] Duplicating contents of DB within same DB with different prefixMartijn Tonies22 Feb
    • Re: [Fwd: search issue] Duplicating contents of DB within same DBwith different prefixIstvan Hubay Cebrian22 Feb
  • Re: Duplicating contents of DB within same DB with different prefixMichael Dykman22 Feb
  • Re: [Fwd: search issue] Duplicating contents of DB within same DBwith different prefixIstvan Hubay Cebrian22 Feb