merge two databse into one by appending data of one to another

  • i have a huge db with some 400 table & i want to append data from another database.the difficulty is when i append one main table the respective foreign key should also get updated.some tables r having multiple references.so how should i progress.

  • you can disable the referential integrity constraints, move all data from other database and then enable the constraint.



    Pradeep Singh

  • but any how i will need proper data.so when i append data say from 10 to 15 then the respective foreign key should get upated.and all tables have identity column.so acoordingly data of other table should change. thats why i cannot update all table at a time.thats my problem

  • Disable the Fkeys, BULKINSERT the data and then enable the Fkeys. For this approach you need to sure that the data being appended will not break any Fkey relationships. Otherwise you will not be able to enable Fkey relationships.

    If possible change the recovery model to Simple so as to prevent Transaction log from growing.

    Once you are done with this you will need to check whether your queries are performing properly. There may be a need to update statistics or even rebuild/reorganize index(es).

    "Keep Trying"

  • If you're not using SSIS, you might want to look into it.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply