对象变量的 SSIS 计数? [英] SSIS Count of Object Variable?

查看:23
本文介绍了对象变量的 SSIS 计数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 BIDS 2008 中使用 SSIS,我试图获取包含文件列表的对象变量的计数.知道如何做到这一点吗?

I am using SSIS in BIDS 2008 and I am trying to get a count of an Object Variable containing a list of files. Any idea on how to do this?

谢谢!

推荐答案

你是如何填充这个对象变量的?根据您填充变量的方式,可以列出更优雅的获取计数的方法.但是,这里有一个快速而肮脏的解决方案:

How are you populating this Object Variable? Depending on how you populate the variable, more eligant ways of getting the count can be listed. However, here is a quick and dirty solution for you:

  1. 创建一个整数类型的新变量并将变量初始化为0
  2. 使用 foreach 循环任务遍历您的对象(打开 foreach 循环编辑器,转到 Collections 并将 Enumerator 更改为 Foreach ADO Enumerator 和 ADO 对象源变量到您的对象变量.
  3. 创建一个执行SQL任务
  4. 在常规选项卡上,将 ResultSet 设置为 Single row 并将您的 sql 语句设置为 SELECT (@Count + 1)
  5. 在参数映射"选项卡中,添加新的整数变量并将 Parameter Name 属性更改为 @Count
  6. 在结果集"选项卡中,添加一个名称为:0 且变量名称为:您新创建的整数变量的新条目.
  1. Create a new variable of type integer and initialize the variable to 0
  2. Use a foreach loop task to iterate over your object (open the foreach loop editor, go to Collections and change the Enumerator to Foreach ADO Enumerator and the ADO object source variable to your Object variable.
  3. Create a Execute SQL Task
  4. On the general tab, set ResultSet to Single row and your sql statement to SELECT (@Count + 1)
  5. In the Parameter Mapping tab, add your new integer variable and change the Parameter Name attribute to @Count
  6. In the Result Set tab, add a new entry with name: 0 and variable name: your newly created integer variable.

循环完成后,您将获得对象的计数.

Once your looping completes, you will have the count of the object.

注意:如果您已经在遍历这些文件(我假设您是这样,因为您正在使用 SSIS 用文件名填充对象变量),您只需要执行步骤 1、3-6.

NOTE: If you are already iterating through these files (which I assume you are since you are using SSIS to populate an Object Variable with file names), you need only perform steps 1, 3-6.

这篇关于对象变量的 SSIS 计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆