Question

If i have an SSIS Excel source reading data from an Excel workbook, is there any way i can query an SQL table for each row returned?

Example: Excel Source returns EmployeeID, EmployeeName and Department. Now for each row returned by the Excel source, is it possible to query an SQL Sever table for the EmployeeCategory where EmployeeID in Excel row matches EmployeeID in the EmployeeCategory SQL table?

Such that i end up with a result set in the format

EmployeeID(Excel), EmployeeName(Excel), Department(Excel) , EmployeeCategory(SQL Table)

Était-ce utile?

La solution

Certainly.

This is exactly what the SSIS Lookup Transformation does.

Have a look here: https://www.youtube.com/watch?v=WMfuXYsWZqM

I should add that, for performance reasons, you really don't want to perform a new query for each record in your data flow - that would be extremely slow. What the SSIS Lookup Transformation does however, is it creates an in-memory cache of your SQL Server table, and then looks up the value of the EmployeeCategory for each record in-memory, which is blazingly fast.

If you are sure you want to actually perform a query for each record, the Lookup Transformation component has a property that lets it run with no cache. If you want even more more flexibility (possibly at an even greater performance loss), you could use the OLE DB Command Transformation, that let's you specify the query you want to execute, for each record in your data flow.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top