views:

24

answers:

1

trying to set up an import form live database to our development database.

I trying to do this using SSIS, but the import is failing because of constraints.

E.g. I have the following tables:

* Customers
* Products
* OrderLines
* Orders

Importing Customers and Products is fine, because they do not depend on anything. But when importing OrderLines it fails because the Order is not yet created.

How do I change the order of how SSIS imports tables?

Or maybe I'm not supposed to use foreign key constraints?

+3  A: 

It sounds like what you already have are foreign key constraints. You want to load the Orders table before you load the OrderLines table.

I'm assuming that you have a single SSIS package that contains one Data Flow task for each target table. You need to create a connection between the Data Flow that loads Orders and the Data Flow that loads OrderLines. This connection is called a precedence constraint.

Select the Orders Data Flow and you should see a green arrow. Click and drag the arrow to the OrderLines task. This creates the precedence constraint that indicates the Orders Data Flow must successfully complete before the OrderLines DataFlow can start.

bobs