Dynamic Columns and tables creation in SSIS

  • Hi I have a table that contains SQL Query's and a table that contain list of server names .Now for each server i have to connect and run each SQL Query's from the table we have .So While running the query's i may get different columns .So is there any way i can capture the data and create dynamic columns and table for each query i run ?

    Thanks in Advance

  • What kind of queries are those? All SELECT?

    If you want to dynamically create tables based on the data you selected, I would use the SELECT ... INTO syntax.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi !

    Yes all the queries are select and they get different data with different structure of columns,So in the run time when the queries are run against the server ,I need to capture these data for each query in destination tables(different tables)

  • And you can't use SELECT INTO because... ?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi !

    I won't be able to use select into as i will be running the multiple query's to a multiple servers(around 400) by looping to each server.

  • And why is that a problem?

    You just create a table with the same name on each server.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Setting up dynamic columns in SSIS (or any ETL tool) is not really that easy as it's not what SSIS was designed for.

    It can be done but usually involves using custom scripting, instead I would look at using SELECT INTO, or another T-sql method to do this.

Viewing 7 posts - 1 through 6 (of 6 total)

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