Retrieve data from SQL Server based on conditional column from Excel using SSIS

  • Hi there,

    I wanna develop SSIS package that simulates the below scenario.

    In one excel file I have single column 'Name'.

    Name

    -----

    ABC

    PQR

    BCD

    MNO

    PAN

    I want to retrieve another column data from SQL server for which where condition will have to match with data in Excel file.

    SQL Server Table:

    ----------------------------

    ID Name Address Phone

    1 ABC XXXXX 12345

    2 PQR XXXXX 12345

    3 BCD XXXXX 12345

    4 LMN XXXXX 12345

    5 PAN XXXXX 12345

    6 MNO XXXXX 12345

    Now I want to retrieve address of each and write in another excel file.

    O/p should be like in another Excel File:

    Name Address

    ABC XXXXX

    PQR XXXXX

    BCD XXXXX

    MNO XXXXX

    PAN XXXXX

    Also sequence of data should be same as given in first file.

    Can anyone help me on this?

    :rolleyes:

  • Sounds like you could do it in 1 dataflow task this way:

      1. First you need 3 connections, 1 to the Excel Source, 1 to the SQL Server, and 1 for the Excel Destination

      2. An Excel Source that queries that returns a sorted list from the source Excel file

      3. A lookup component that uses the SQL Server Connection with the Lookup column to be NAME and select as many columns as you need from the lookup query. You need to be careful here because the SSIS lookup component is case and length sensitive so you may need to use the Advanced tab of the lookup configuration and Enable Memory Restriction. You may also need to use the Modify SQL Statement which will cause the SQL Server to be queried for each row instead of caching the results of the lookup query in memory.

      4. An Excel destination using your Excel Destination Component.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

  • Thanks a lot..!!!

    :rolleyes:

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply