从SSIS脚本任务中的列表更新表的最佳方法是什么?
我们有一个共享类库。我在脚本任务中使用了dll来完成大部分必要的工作。然后,dll方法返回一个列表,其中包含与它运行的进程相关的数据。我的工作是把这个列表写到一个表中。
我想我将遍历列表中的每个项目,并运行update SQL语句。
为简洁起见,我没有粘贴SQL语句,但它实际上是使用MERGE的Upsert。
实际上,我希望有一种方法可以将列表输出到执行SQL任务的输入,但我不确定这是否可行。
这是我到目前为止的情况。正如你所看到的,它还没有完成。
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 = ""
}
}