Home SSIS Script Task: How to update table from List<T>
Reply: 0

SSIS Script Task: How to update table from List<T>

user1312
1#
user1312 Published in May 25, 2018, 2:21 pm

What is the best way to update a table from a List inside an SSIS Script Task?

We have a shared class library. I have used the dll in the script task to do most of the necessary work. The dll method then returns a List which contains data related to the processes that it ran. It is my job to write this list to a table.

I'm thinking I will loop through each item in the List and and run the update SQL statement.

For brevity, I did not paste the SQL statement, but it is actually an Upsert using MERGE.

Actually, I wish there were a way to output the List to the input of an Execute SQL Task, but I'm unsure if that is possible.

Here is what I have so far. As you can see it is unfinished.

  private void UpdateEtlData(List<ProcessStatitics> statistics)
    {
        var connection = GetOhioConnectionString();

        // will loop thru each item in statistics and run the 
        // following sequence. This code is unfinished, but
        // I will use properties inside each statistic to form the 
        // query
        foreach(statistic in statistics)
        {
            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandText = ""
        }
    }
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303042 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO