Suspend table restrictions during SSIS import

I am trying to sow an empty database from a production database using the import / export wizard. How to convince SQL Server to ignore foreign key violations?

THX

+4
source share
1 answer

There is an option to check constraints on the OleDbDestination component. cancel it and it will ignore foreign keys.

I really dislike this option, so I suggest two other ways:

1) Always copy the tables in the "reverse" order of the key. For example, if you have a key from A to B, first copy table B and then table A

2) use Exec SQL Task to disable foreign keys using NOCHECK CONSTRAINT (example here ) before copying, and another to include after copy

+3
source

Source: https://habr.com/ru/post/1403110/


All Articles