Hi,
I have the following staging tables:
1.ContactDemographics
2.Contact ( The contact table has a foreign key reference to ContactDemographics)
3.Address
4.AddressInstance ( The addressInstance table has foreign key references to Contact and Address Table)
5. HomeImprovements ( The HomeImprovements table has foreign key references to Contact table)
Since HomeImprovments table and the AddressInstance are not referenced by any other tables I can truncate these 2 tables for the staging load.
For the others I cannot truncate tables as they are being referenced in other tables : The option that I have is to truncate HomeImprovments table and the AddressInstance and then delete data from Contact and ContactDemographics.
I totally understand why the table it is not possible to truncate a table which has references to other table. ( Foreign Key Constraints)
My question/concern is
1. What is the best practices to handle staging load when it comes to loading data into staging tables with referential integrity ? Is it a good practice to truncate tables which are not referenced and then delete data ( reset identity) from the tables which are being referenced in a particular order OR it is a good practice to alter table and disable/drop constraints and then enable/create constraints when the package finishes. I have a single SSIS package for staging load for each table
Please suggest best practice in such kind of scenario?
Thanks
EVA05