January 13, 2009 at 12:30 am
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.
January 13, 2009 at 12:37 am
you can disable the referential integrity constraints, move all data from other database and then enable the constraint.
January 13, 2009 at 12:41 am
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
January 13, 2009 at 12:46 am
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"
January 13, 2009 at 6:34 am
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