Query a database based on result of query from another database

前端 未结 5 2078
粉色の甜心
粉色の甜心 2020-12-01 21:42

I am using SSIS in VS 2013. I need to get a list of IDs from 1 database, and with that list of IDs, I want to query another database, ie SELECT ... from MySecondDB WHE

5条回答
  •  独厮守ぢ
    2020-12-01 22:34

    This is a classic case for using LookUp Transformation. First, use a OLE DB Source to get data from the first database. Then, use a LookUp Transformation to filter this data-set based on the ID values from the second data-set. Here is the steps for using a LookUp Transformation:

    1. In the General tab, select Full Cash, OLE DB Connection Manager and Redirect rows to no match output as shown in the following picture. Notice that using Full Cash provides great performance for your package.

    General Setting

    1. In the Connection tab, use OLE DB Connection Manager to connect to your second server. Then, you can either directly select the data-set with ID values or (as is shown in the picture below) you can use SQL code to select the IDs from the filtering data-set.

    Connection:

    1. Go to Columns tab and select ID columns from the both datasets. For each record from your first data-set, it will check to see if its ID is in the Available LookUp Column. If it is, it will go to the Matching output, else to No Matching output.

    Match ID columns:

    1. Click on OK to close the LookUp. Then you need to select the LookUp Match Output.

    Match Output:

提交回复
热议问题