dbTalk Databases Forums  

How do I copy records and their relational records too?

comp.databases comp.databases


Discuss How do I copy records and their relational records too? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dterrors@hotmail.com
 
Posts: n/a

Default How do I copy records and their relational records too? - 02-04-2008 , 04:54 PM







If I have a M2M set of tables (so three tables- two with "real" data,
and one binding table in the middle). How do I make copies?

table a: id, column1, column2... column50
table b: id, column1, column2... column50
table c: id, db_a_id, db_b_id

I can't do insert...select because the keys will all be different on
the newly copied tables. So how do I keep the binding in place?

I'm guessing this is a common problem...

I have mysql 5.0.22



Reply With Quote
  #2  
Old   
Paul Lautman
 
Posts: n/a

Default Re: How do I copy records and their relational records too? - 02-04-2008 , 04:55 PM






dterrors (AT) hotmail (DOT) com wrote:
Quote:
I can't do insert...select because the keys will all be different on
the newly copied tables.
Why?




Reply With Quote
  #3  
Old   
Paul Lautman
 
Posts: n/a

Default Re: How do I copy records and their relational records too? - 02-04-2008 , 04:55 PM



dterrors (AT) hotmail (DOT) com wrote:
Quote:
I can't do insert...select because the keys will all be different on
the newly copied tables.
Why?




Reply With Quote
  #4  
Old   
Paul Lautman
 
Posts: n/a

Default Re: How do I copy records and their relational records too? - 02-04-2008 , 04:55 PM



dterrors (AT) hotmail (DOT) com wrote:
Quote:
I can't do insert...select because the keys will all be different on
the newly copied tables.
Why?




Reply With Quote
  #5  
Old   
dterrors@hotmail.com
 
Posts: n/a

Default Re: How do I copy records and their relational records too? - 02-04-2008 , 04:58 PM



On Feb 4, 4:55 pm, "Paul Lautman" <paul.laut... (AT) btinternet (DOT) com> wrote:
Quote:
dterr... (AT) hotmail (DOT) com wrote:
I can't do insert...select because the keys will all be different on
the newly copied tables.

Why?
Because I'm copying records. So therefore their keys will be
different. Unique keys? Two records can't have the same key?


Reply With Quote
  #6  
Old   
dterrors@hotmail.com
 
Posts: n/a

Default Re: How do I copy records and their relational records too? - 02-04-2008 , 04:58 PM



On Feb 4, 4:55 pm, "Paul Lautman" <paul.laut... (AT) btinternet (DOT) com> wrote:
Quote:
dterr... (AT) hotmail (DOT) com wrote:
I can't do insert...select because the keys will all be different on
the newly copied tables.

Why?
Because I'm copying records. So therefore their keys will be
different. Unique keys? Two records can't have the same key?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.