How to execute SQL Statement to make it as source and Load into Destination table in SSIS

varaprasadmohan pinagadi 1 Reputation point
2021-02-17T16:07:00.977+00:00

I have a table dbo.Test whose columns (ID,Query_Column)

ID Query_Column

1 SELECT CustomerKey, FirstName, LastName, MaritalStatus, Gender FROM CUSTOMER_DETAILS

In Query column I have a select statement which have some data.

Now In my SSIS Package I want to make it as Source columns and Load into Destination Table dynamically.

Source

CustomerKey
FirstName
LastName
MaritalStatus
Gender

Destination

CustomerKey
FirstName
LastName
MaritalStatus
Gender

Now In my SSIS Package I want to make it as Source columns and Load into Destination Table dynamically.

Can anyone suggest me on this .

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

3 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,586 Reputation points
    2021-02-17T16:39:19.467+00:00

    SSIS is based on static metadata. So it will not work with dynamic columns.
    You need to look at 3rd party products: CozyRoc

    Another alternative would be to use SSIS Execute SQL Task from a dynamically composed SQL statement. Along the following:

    INSERT INTO ...
    SELECT ... FROM ...
    

  2. Tom Phillips 17,771 Reputation points
    2021-02-17T18:29:11.037+00:00

    SSIS must have column and table names at DESIGN time, not runtime. SSIS is not capable of dynamic transfer of data at runtime.

    0 comments No comments

  3. EchoLiu-MSFT 14,621 Reputation points
    2021-02-18T08:23:13.01+00:00

    Hi @varaprasadmohan pinagadi

    When creating the connection manager, select the date access mode as sql command. Insert the data set returned by your select statement into a temporary table and copy it to the command box.

    69384-screenshot-2021-02-18-162112.png

    If you have any question, please feel free to let me know.
    If the response is helpful, please click "Accept Answer" and upvote it.

    Regards
    Echo


    If the answer is helpful, please click "Accept Answer" and upvote it.
    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.