简体   繁体   中英

How to insert data from multiple tables to multiple tables by using SSIS?

I am using SQL Server 2008 R2. I have almost 106+ tables in database and now I need to load data from these tables into another database.

Table structure of source and destination database are same. There is a status table in the database and all tables have a Primary Key ID field. All the tables have Primary key and Foreign key relationship.

Status table contain the ID field of tables and anther column contain a status of related ID field that this ID has completed its task.

I need to transfer data those ID number will match with Status table where ID status is 1 or something like this. I need to insert Identity column also, and because of all the table have PK and FK relationship so i have to insert data into tables with referential constraints.

So, my questions here is: To fulfill my above scenario how can I load data from multiple tables to multiple tables by using SSIS because it is not one time thing.

Status table idea is not clear.i hv 160+ tables then status table will contain what ? give example.

Of course you hv to start with diagram/flow

suppose

table1 id pk
table2 id pk (table1 id fk)
table3 id pk (table2 id fk)

insert into table1
insert into table2
insert into table3

In my example you can't first inert into table3 becasue of FK constraint. This way first you hv to make flow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM