SSIS (SQL Server Integration Services) Lookup Transformations are components used in data flow tasks to perform lookups on a dataset, typically to retrieve additional information from a reference table based on a matching key. Add and configure the Lookup Currency Key transformation
- In the SSIS Toolbox, expand Common, and then drag Lookup onto the design surface of the Data Flow tab. Place Lookup directly below the Extract Sample Currency Data source.
- Select the Extract Sample Currency Data flat file source and drag its blue arrow onto the newly added Lookup transformation to connect the two components.
- On the Data Flow design surface, select Lookup in the Lookup transformation, and change the name to Lookup Currency Key.
- Double-click the Lookup Currency Key transformation to display the Lookup Transformation Editor.
- On the General page, select Full cache.
- In the Connection type area, select OLE DB connection manager.
- On the Connection page, in the OLE DB connection manager dialog box, ensure that localhost.AdventureWorksDW2022 is displayed.
- Select Use results of a SQL query, and then enter or paste the following SQL statement:
SQLCopy
SELECT * FROM [dbo].[DimCurrency]
WHERE [CurrencyAlternateKey]
IN (‘ARS’, ‘AUD’, ‘BRL’, ‘CAD’, ‘CNY’,
‘DEM’, ‘EUR’, ‘FRF’, ‘GBP’, ‘JPY’,
‘MXN’, ‘SAR’, ‘USD’, ‘VEB’)
Select Preview to verify the query results.
- On the Columns page, in the Available Input Columns panel, drag CurrencyID to the Available Lookup Columns panel and drop it on CurrencyAlternateKey.
- In the Available Lookup Columns list, select the check box to the left of CurrencyKey.
- Select OK to return to the Data Flow design surface.
- Right-click the Lookup Currency Key transformation and select Properties.
- In the Properties window, verify that the LocaleID property is English (United States) and the DefaultCodePage property is 1252.
Add and configure the Lookup Date Key transformation
- In the SSIS Toolbox, drag Lookup onto the Data Flow design surface. Place this Lookup directly below the Lookup Currency Key transformation.
- Select the Lookup Currency Key transformation and drag its blue arrow onto the new Lookup transformation to connect the two components.
- In the Input Output Selection dialog, select Lookup Match Output in the Output list box, and then select OK.
- On the Data Flow design surface, select the name Lookup in the newly added Lookup transformation and change that name to Lookup Date Key.
- Double-click the Lookup Date Key transformation.
- On the General page, select Partial cache.
- On the Connection page, in the OLEDB connection manager dialog, ensure that localhost.AdventureWorksDW2022 is displayed.
- In the Use a table or view box, enter or select [dbo].[DimDate].
- On the Columns page, in the Available Input Columns panel, drag CurrencyDate to the Available Lookup Columns panel and drop it on FullDateAlternateKey. If you see a message indicating a data type mismatch, change the data type of CurrencyDate to [DT_DBDATE].
- In the Available Lookup Columns list, select the check box to the left of DateKey.
- On the Advanced page, review the caching options.
- Select OK to return to the Data Flow design surface.
- Right-click the Lookup Date Key transformation and select Properties.
- In the Properties window, verify that the LocaleID property is English (United States) and the DefaultCodePage property is 1252.
Leave a Reply