Question

I have the following scenario where I need to reload a table in SQL Server 2008 R2 with data located on another server. The target table has indexes (clustered and non clustered) and constraints (foreign keys to multiple tables), while the primary key is also a foreign key to another separate table. Also primary key on target table is an identity.

What would be the most appropriate, I would say, "best practice" in approaching this situation?

Would the following be reasonable:

  • Drop indexes on target table - (SQL Script Task)
    • First drop non clustered indexes
    • Second, drop clustered index
  • DataFlow point from source table to target table.
    • In Destination Editor, check Keep Identity, Keep nulls, and uncheck Check constraints
  • Create indexes on target table - (SQL Script Task)

Note that table structure and constraints are expected to be the same in source table and target table. In other words, same everything just reloading data per say from QA to development.

Was it helpful?

Solution

seems good but Don't drop clustered index if you want you can disable all foreign key constraints and after load you can enable with NOCHECK if your data is not relational consistancy

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top