Copy a record from a database with several related tables

Asked

Viewed 121 times

0

I’m trying to copy a record from a database table, but the problem is that this table has a lot of links, foreign keys. The record should involve about 40 tables. Is there any way I can do this? I just need to duplicate the record by changing a single value. It’s possible?

I couldn’t do anything.

  • Is there no way to make an Insert by just changing what you need? You can explain better?

  • To put it better, I have some records here in the bank, which correspond to a questionnaire, only a questionnaire has people involved, has hours worked, various data, which are in another table... I wanted to duplicate a questionnaire, only for that, have replicate the data in all tables.

  • It’s not really that, it’s copying the same tables. When I open the program that consumes this bank, I want you to have 2 questionnaires, one equal to the other, just with the different ID.

  • 1

    Tables are in the same database? what is the problem you have now? mount query? FK violation?

  • The problem is like this: Let’s assume that I duplicate a row of the QUESTIONNAIRES table, so let’s assume that each questionnaire has an ID, 1 and 2, in the other tables I have records referencing ID 1, I need these records also to be duplicated, but referencing ID 2. Did you understand more or less? I need to duplicate the questionnaire completely.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.