How can I duplicate records?

M

Marco

Hi. I have Table1 and Table2.

Table1 and Table2 have a relationship. One record in Table1 has many records
in Table2.

I have the need to duplicate all records from Table2 according to a criteria
and of course I also have to duplicate the record in Table1.

How can I do it?

regards,
Marco
 
A

Amy Blankenship

Marco said:
Hi. I have Table1 and Table2.

Table1 and Table2 have a relationship. One record in Table1 has many
records
in Table2.

I have the need to duplicate all records from Table2 according to a
criteria
and of course I also have to duplicate the record in Table1.

If you add a field to Table 1 that tells you what the ID was for the
original record, then when you do an Insert based on the query, you can
replace the FK with the ID of the new record based on the ID of the original
record that was in the FK field of the duplicated records. I am not sure if
there is any way to do it without adding a field. I've been pondering that
myself.
 
M

Marco

Hi. I didn't understood very well your ideas.

I'm thinking to create a temp table where I will put the records of my table
two. Then Copy to my table table2 but the relationgship field will be the one
of the new record of table1

What do you think?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top