SCOPE_IDENTITY () for bulk insert in SSIS

In SSIS, I can insert rows and get their SCOPE_IDENTITY using the OLE DB Command Task, which calls a stored procedure, but this is not a bulk insert, it is slow loading. Is it possible to get the id of inserted rows using bulk insert in SSIS?

Example: When inserting a customer, you first need to insert the record into the Person table, and then use this FK in the Customer table.

UPDATE:

Here is the structure of the Person and Customer tables that must be populated from an external source.

enter image description here

One option is to have an OriginalId in Person table so that I can use it when searching when populating the Customer table. But this does not answer my question about SCOPE_IDENTITY and fast loading

0
sql-server insert ssis bulk
source share
1 answer

I would suggest performing your insertions in two separate data flow tasks.

Example:

Data Stream 1 - Insert into Person table

Data Stream 2 - Search for FK from the Person table and then insert into the Customer table

+2
source share

All Articles