How to insert data into destination table using flat file source in SSIS

Dadu Gosavi 1 Reputation point
2022-04-06T08:55:43.997+00:00

I have SSIS package, in which flow is -

Get the data from flat file source and insert it into staging table.
Use the staging table data for transformation using select and where clause and then insert filtered data in destination. table.

For 1st point, I have taken Data flow task to get the data from source and insert data into staging table. For 2nd point, I am confused, how should I do it. I am using Execute SQL task to run Select-Where query but the not getting how will I insert that query result into destination table. Which SSIS component should I use here. Or shall I change the entire flow for better performance. Kindly suggest. Thanks in advance.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
Developer technologies | Transact-SQL
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Tom Phillips 17,771 Reputation points
    2022-04-06T13:56:02.537+00:00

    The simplest solution is to create a stored proc to transfer your stage table to the target table, and use execute SQL statement to execute the proc.

    0 comments No comments

  2. ZoeHui-MSFT 41,491 Reputation points
    2022-04-07T02:05:42.6+00:00

    Hi @Dadu Gosavi ,

    After loading data to the staging table, you may use execute-sql-task to load the select and where query.

    Use query such as

    INSERT INTO DestinatinTable (Columnvalue1, Columnvalue2)  
    SELECT Columnvalue1, Columnvalue2  FROM StagingTable WHERE ...  
    

    If I misunderstand your need, please correct me.

    Regards,

    Zoe


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.