Foreach 迴圈容器Foreach Loop Container

「Foreach 迴圈」容器定義封裝中重複的控制流程。The Foreach Loop container defines a repeating control flow in a package. 迴圈實作與程式設計語言中 Foreach 迴圈的結構類似。The loop implementation is similar to Foreach looping structure in programming languages. 在封裝中,迴圈是使用 Foreach 列舉值啟用。In a package, looping is enabled by using a Foreach enumerator. 「Foreach 迴圈」容器會為指定列舉值的每個成員重複控制流程。The Foreach Loop container repeats the control flow for each member of a specified enumerator.

SQL ServerSQL Server Integration ServicesIntegration Services 提供下列列舉值類型: Integration ServicesIntegration Services provides the following enumerator types:

  • Foreach ADO 列舉值,用來列舉資料表中的資料列。Foreach ADO enumerator to enumerate rows in tables. 例如,您可以在 ADO 資料錄集中取得資料列。For example, you can get the rows in an ADO recordset.

    資料錄集目的地會將記憶體中的資料儲存到 Object 資料類型之封裝變數中儲存的資料錄集。The Recordset destination saves data in memory in a recordset that is stored in a package variable of Object data type. 您通常會使用具有 Foreach ADO 列舉值的 Foreach 迴圈容器來一次處理資料錄集的一個資料列。You typically use a Foreach Loop container with the Foreach ADO enumerator to process one row of the recordset at a time. 針對 Foreach ADO 列舉值指定的變數必須屬於 Object 資料類型。The variable specified for the Foreach ADO enumerator must be of Object data type. 如需有關資料錄集目的地的詳細資訊,請參閱< Use a Recordset Destination>。For more information about the Recordeset destination, see Use a Recordset Destination.

  • 「Foreach ADO.NET 結構描述資料列集」列舉值,用來列舉有關資料來源的結構描述資訊。Foreach ADO.NET Schema Rowset enumerator to enumerate the schema information about a data source. 例如,您可以列舉並取得一份 AdventureWorks2012AdventureWorks2012 SQL ServerSQL Server 資料庫中資料表的清單。For example, you can enumerate and get a list of the tables in the AdventureWorks2012AdventureWorks2012 SQL ServerSQL Server database.

  • 「Foreach 檔案」列舉值,用來列舉資料夾中的檔案。Foreach File enumerator to enumerate files in a folder. 列舉值可往返子資料夾。The enumerator can traverse subfolders. 例如,您可以讀取 Windows 資料夾及其子資料夾中所有副檔名為 *.log 的檔案。For example, you can read all the files that have the *.log file name extension in the Windows folder and its subfolders.

  • Foreach From Variable 列舉值,用來列舉指定的變數所包含的可列舉物件。Foreach From Variable enumerator to enumerate the enumerable object that a specified variable contains. 可列舉物件可以是陣列、ADO.NET DataTableIntegration ServicesIntegration Services 列舉值等等。The enumerable object can be an array, an ADO.NET DataTable, an Integration ServicesIntegration Services enumerator, and so on. 例如,您可以列舉包含伺服器名稱之陣列的值。For example, you can enumerate the values of an array that contains the name of servers.

  • 「Foreach 項目」列舉值,用來列舉集合項目。Foreach Item enumerator to enumerate items that are collections. 例如,您可以列舉「執行處理」工作使用之可執行檔與工作目錄的名稱。For example, you can enumerate the names of executables and working directories that an Execute Process task uses.

  • Foreach Nodelist 列舉值,用來列舉 XML 路徑語言 (XPath) 運算式的結果集。Foreach Nodelist enumerator to enumerate the result set of an XML Path Language (XPath) expression. 例如,此運算式會列舉並取得一份古典時期所有作者的清單: /authors/author[@period='classical']For example, this expression enumerates and gets a list of all the authors in the classical period: /authors/author[@period='classical'].

  • Foreach SMO 列舉值,用來列舉 SQL ServerSQL Server Management Objects (SMO) 物件。Foreach SMO enumerator to enumerate SQL ServerSQL Server Management Objects (SMO) objects. 例如,您可以列舉並取得一份 SQL ServerSQL Server 資料庫中檢視的清單。For example, you can enumerate and get a list of the views in a SQL ServerSQL Server database.

  • [Foreach HDFS 檔案列舉值] 可列舉所指定 HDFS 位置中的 HDFS 檔案。Foreach HDFS File Enumerator to enumerate HDFS files in the specified HDFS location.

  • Foreach Azure Blob 列舉值會列舉在 Azure 儲存體 blob 容器中的 Blob。Foreach Azure Blob enumerator to enumerate blobs in a blob container in Azure Storage.

  • 列舉 ADLS 目錄中的檔案的 ADLS Foreach 檔案列舉值。Foreach ADLS File enumerator to enumerate files in an ADLS directory.

    下列圖表顯示擁有「檔案系統」工作的「Foreach 迴圈」容器。The following diagram shows a Foreach Loop container that has a File System task. Foreach 迴圈會使用「Foreach 檔案」列舉值,而「檔案系統」工作則設定為複製檔案。The Foreach loop uses the Foreach File enumerator, and the File System task is configured to copy a file. 如果列舉值指定的資料夾含有四個檔案,則迴圈會重複四次並複製四個檔案。If the folder that the enumerator specifies contains four files, the loop repeats four times and copies four files.

    列舉資料夾的 Foreach 迴圈 」 容器A Foreach Loop container that enumerates a folder

    您可以使用變數和屬性運算式的組合,以列舉值集合值更新封裝物件的屬性。You can use a combination of variables and property expressions to update the property of the package object with the enumerator collection value. 首先,對應集合值與使用者定義的變數,接著在使用該變數的屬性上實作屬性運算式。First you map the collection value to a user-defined variable, and then you implement a property expression on the property that uses the variable. 例如,「Foreach 檔案」列舉值的集合值會對應到稱為 MyFile 的變數,接著會在傳送郵件工作的 Subject 屬性的屬性運算式中使用此變數。For example, the collection value of the Foreach File enumerator is mapped to a variable called MyFile and the variable is then used in the property expression for the Subject property of a Send Mail task. 當執行封裝時,便會在每次迴圈重複時以某個檔案名稱更新 Subject 屬性。When the package runs, the Subject property is updated with the name of a file each time that the loop repeats. 如需詳細資訊,請參閱 在封裝中使用屬性運算式For more information, see Use Property Expressions in Packages.

    對應至列舉值集合值的變數亦可在運算式和指令碼中使用。Variables that are mapped to the enumerator collection value can also be used in expressions and scripts.

    「Foreach 迴圈」容器可包含多項工作和容器,但它只能使用一種列舉值。A Foreach Loop container can include multiple tasks and containers, but it can use only one type of enumerator. 如果「Foreach 迴圈」容器包含多項工作,您可將列舉值集合值對應至每項工作的多個屬性。If the Foreach Loop container includes multiple tasks, you can map the enumerator collection value to multiple properties of each task.

    您可以在「Foreach 迴圈」容器上設定交易屬性,用來定義封裝控制流程子集的交易。You can set a transaction attribute on the Foreach Loop container to define a transaction for a subset of the package control flow. 您可利用此方式於「Foreach 迴圈」層級管理交易,而非封裝層級。In this way, you can manage transactions at the level of the Foreach Loop instead of the package level. 例如,如果「Foreach 迴圈」容器重複更新星狀結構描述中維度和事實資料表的控制流程,則可設定交易以確認所有事實資料表均成功更新,或不更新任何資料表。For example, if a Foreach Loop container repeats a control flow that updates dimensions and fact tables in a star schema, you can configure a transaction to ensure that all fact tables are updated successfully, or none are updated. 如需詳細資訊,請參閱 Integration Services 交易For more information, see Integration Services Transactions.

列舉值類型Enumerator Types

列舉值可加以設定,而您必須根據列舉值提供不同的資訊。Enumerators are configurable, and you must provide different information, depending on the enumerator.

下表摘要說明各列舉值類型所需的資訊。The following table summarizes the information each enumerator type requires.

列舉值Enumerator 組態需求Configuration requirements
Foreach ADOForeach ADO 指定 ADO 物件來源變數和列舉值模式。Specify the ADO object source variable and the enumerator mode. 此變數必須屬於 Object 資料類型。The variable must be of Object data type.
Foreach ADO.NET 結構描述資料列集Foreach ADO.NET Schema Rowset 指定資料庫的連接和要列舉的結構描述。Specify the connection to a database and the schema to enumerate.
Foreach 檔案Foreach File 指定資料夾和要列舉的檔案、所擷取檔案的檔名格式,以及是否往返子資料夾。Specify a folder and the files to enumerate, the format of the file name of the retrieved files, and whether to traverse subfolders.
Foreach From VariableForeach From Variable 指定包含要列舉物件的變數。Specify the variable that contains the objects to enumerate.
Foreach 項目Foreach Item 定義「Foreach 項目」集合中的項目,包括資料行和資料行資料類型。Define the items in the Foreach Item collection, including columns and column data types.
Foreach NodelistForeach Nodelist 指定 XML 文件的來源並設定 XPath 作業。Specify the source of the XML document and configure the XPath operation.
Foreach SMOForeach SMO 指定資料庫的連接和要列舉的 SMO 物件。Specify the connection to a database and the SMO objects to enumerate.
Foreach HDFS 檔案列舉值Foreach HDFS File Enumerator 指定資料夾和要列舉的檔案、所擷取檔案的檔名格式,以及是否往返子資料夾。Specify a folder and the files to enumerate, the format of the file name of the retrieved files, and whether to traverse subfolders.
Foreach Azure BlobForeach Azure Blob 指定要列舉的 blob 容器的 Azure Blob 容器。Specify the Azure blob container that containers blobs to be enumerated.
Foreach ADLS 檔案Foreach ADLS File 指定包含要列舉的有些篩選條件以及檔案的 ADLS 目錄。Specify the ADLS directory that contains files to be enumerated, along with some filters.

將列舉加入控制流程,與 Foreach 迴圈容器Add enumeration to a control flow with a Foreach Loop container

Integration ServicesIntegration Services包含 「 Foreach 迴圈 」 容器,可簡化包括列舉檔案及物件中封裝的控制流程的迴圈建構的控制流程元素。 includes the Foreach Loop container, a control flow element that makes it simple to include a looping construct that enumerates files and objects in the control flow of a package. 如需詳細資訊,請參閱 Foreach 迴圈容器>。For more information, see Foreach Loop Container.

「Foreach 迴圈」容器不提供功能,僅提供可在其中建立可重複控制流程、指定列舉類型並設定列舉值的結構。The Foreach Loop container provides no functionality; it provides only the structure in which you build the repeatable control flow, specify an enumerator type, and configure the enumerator. 若要提供容器功能,必須在「Foreach 迴圈」容器中至少包括一個工作。To provide container functionality, you must include at least one task in the Foreach Loop container. 如需詳細資訊,請參閱 Integration Services TasksFor more information, see Integration Services Tasks.

「Foreach 迴圈」容器可以包括具有多個工作的控制流程及其他容器。The Foreach Loop container can include a control flow with multiple tasks and other containers. 將工作及容器加入「Foreach 迴圈」容器與將它們加入封裝類似,只是您要將工作及容器拖曳至「Foreach 迴圈」容器而不是封裝。Adding tasks and containers to a Foreach Loop container is similar to adding them to a package, except you drag the tasks and containers to the Foreach Loop container instead of to the package. 如果「Foreach 迴圈」容器包含一個以上的工作或容器,則您可以如同在封裝中所做的一樣,使用優先順序條件約束來連接它們。If the Foreach Loop container includes more than one task or container, you can connect them using precedence constraints just as you do in a package. 如需詳細資訊,請參閱 Precedence ConstraintsFor more information, see Precedence Constraints.

加入和設定 Foreach 迴圈容器Add and configure a Foreach Loop container

  1. 將「Foreach 迴圈」容器加入封裝。Add the Foreach Loop container to the package. 如需詳細資訊,請參閱 在控制流程中加入或刪除工作或容器For more information, see Add or Delete a Task or a Container in a Control Flow.

  2. 將工作和容器加入「Foreach 迴圈」容器。Add tasks and containers to the Foreach Loop container. 如需詳細資訊,請參閱 在控制流程中加入或刪除工作或容器For more information, see Add or Delete a Task or a Container in a Control Flow.

  3. 使用優先順序條件約束連接「Foreach 迴圈」容器中的工作和容器。Connect tasks and containers in the Foreach Loop container using precedence constraints. 如需詳細資訊,請參閱 使用預設的優先順序條件約束來連接工作和容器For more information, see Connect Tasks and Containers by Using a Default Precedence Constraint.

  4. 設定「Foreach 迴圈」容器。Configure the Foreach Loop container. 如需詳細資訊,請參閱 設定 Foreach 迴圈容器>。For more information, see Configure a Foreach Loop Container.

設定 Foreach 迴圈容器Configure a Foreach Loop Container

此程序描述如何設定「Foreach 迴圈」容器,包括列舉值及容器層級的屬性運算式。This procedure describes how to configure a Foreach Loop container, including property expressions at the enumerator and container levels.

  1. SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT)中,開啟包含所需封裝的 Integration ServicesIntegration Services 專案。In SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT), open the Integration ServicesIntegration Services project that contains the package you want.

  2. 按一下 [控制流程] 索引標籤,然後按兩下 [Foreach 迴圈]。Click the Control Flow tab and double-click the Foreach Loop.

  3. 在 [Foreach 迴圈編輯器] 對話方塊中,按一下 [一般],然後選擇性地修改 [Foreach 迴圈] 的名稱及描述。In the Foreach Loop Editor dialog box, click General and, optionally, modify the name and description of the Foreach Loop.

  4. 按一下 [集合]從 [列舉值] 清單選取列舉值類型。Click Collection and select an enumerator type from the Enumerator list.

  5. 指定列舉值並設定列舉值選項如下:Specify an enumerator and set enumerator options as follows:

    • 若要使用 Foreach 檔案列舉值,請提供包含要列舉之檔案的資料夾,指定檔案名稱及類型的篩選,並指定是否應該傳回完整的檔案名稱。To usethe Foreach File enumerator, provide the folder that contains the files to enumerate, specify a filter for the file name and type, and specify whether the fully qualified file name should be returned. 同時,指示是否遞迴所有子資料夾,以取得更多檔案。Also, indicate whether to recurse through subfolders for more files.

    • 若要使用 Foreach 項目列舉值,請按一下 [資料行],然後在 [For Each 項目資料行] 對話方塊中,按一下 [加入]以加入資料行。To use the Foreach Item enumerator, click Columns, and, in the For Each Item Columns dialog box, click Add to add columns. 在 [資料類型] 清單中為每個資料行選取資料類型,然後按一下 [確定]。Select a data type in the Data Type list for each column, and click OK.

      在資料行中鍵入值,或從清單選取值。Type values in the columns or select values from lists.

      注意

      若要加入新的資料列,請按一下您鍵入項目之資料格以外的任何位置。To add a new row, click anywhere outside the cell in which you typed.

      注意

      如果值與資料行資料類型不相容,則文字會反白顯示。If a value is not compatible with the column data type, the text is highlighted.

    • 若要使用 Foreach ADO 列舉值,請選取現有的變數,或按一下 [ADO 物件來源變數] 清單中的 [新增變數],以指定包含要列舉之 ADO 物件名稱的變數,然後選取列舉模式選項。To use the Foreach ADO enumerator, select an existing variable or click New variable in the ADO object source variable list to specify the variable that contains the name of the ADO object to enumerate, and select an enumeration mode option.

      如果要建立新變數,請在 [加入變數] 對話方塊中設定變數屬性。If creating a new variable, set the variable properties in the Add Variable dialog box.

    • 若要使用 Foreach ADO.NET 結構描述資料列集列舉值,請選取現有的 ADO.NET 連接,或按一下 [連接] 清單中的 [新增連接],然後選取結構描述。To use the Foreach ADO.NET Schema Rowset enumerator, select an existing ADO.NET connection or click New connection in the Connection list, and then select a schema.

      您可選擇按一下 [設定限制] 並選取結構描述限制,再選取包含限制值的變數或輸入限制值,然後按一下 [確定]。Optionally, click Set Restrictions and select schema restrictions, select the variable that contains the restriction value or type the restriction value, and click OK.

    • 若要使用 Foreach From Variable 列舉值,請在 [變數] 清單中選取變數。To use the Foreach From Variable enumerator, select a variable in the Variable list.

    • 若要使用 Foreach NodeList 列舉值,請按一下 [DocumentSourceType] 並從清單中選取來源類型,然後按一下 [DocumentSource]。To use the Foreach NodeList enumerator, click DocumentSourceType and select the source type from the list, and then click DocumentSource. 視 DocumentSourceType 所選的值而定,從清單中選取變數或檔案連接、建立新的變數或檔案連接,或在 [文件來源編輯器] 中輸入 XML 來源。Depending on the value selected for DocumentSourceType, select a variable or a file connection from the list, create a new variable or file connection, or type the XML source in the Document Source Editor.

      接著,按一下 [EnumerationType] 並從清單中選取列舉類型。Next, click EnumerationType and select an enumeration type from the list. 如果 EnumerationType 是 Navigator、Node 或 NodeText,請按一下 [OuterXPathStringSourceType] 並選取來源類型,然後按一下 [OuterXPathString]。If EnumerationType is Navigator, Node, or NodeText, click OuterXPathStringSourceType and select the source type, and then click OuterXPathString. 視 OuterXPathStringSourceType 所設定的值而定,從清單中選取變數或檔案連接、建立新的變數或檔案連接,或為外部 XML 路徑語言 (XPath) 運算式輸入字串。Depending on the value set for OuterXPathStringSourceType, select a variable or a file connection from the list, create a new variable or file connection, or type the string for the outer XML Path Language (XPath) expression.

      如果 EnumerationType 是 ElementCollection,請如上所述設定 OuterXPathStringSourceType 和 OuterXPathString。If EnumerationType is ElementCollection,set OuterXPathStringSourceType and OuterXPathString as described above. 然後,按一下 [InnerElementType] 並為內部元素選取列舉類型,再按一下 [InnerXPathStringSourceType]。Then, click InnerElementType and select an enumeration type for the inner elements, and then click InnerXPathStringSourceType. 視 InnerXPathStringSourceType 所設定的值而定,選取變數或檔案連接、建立新的變數或檔案連接,或為內部 XPath 運算式輸入字串。Depending on the value set for InnerXPathStringSourceType, select a variable or a file connection, create a new variable or file connection, or type the string for the inner XPath expression.

    • 若要使用 Foreach SMO 列舉值,請選取現有的 ADO.NET 連接,或按一下 [連接] 清單中的 [新增連接],然後輸入要使用的字串或按一下 [瀏覽]。To use the Foreach SMO enumerator, select an existing ADO.NET connection or click New connection in the Connection list, and then either type the string to use or click Browse. 如果按一下 [選取 SMO 列舉] 對話方塊中的 [瀏覽],請選取要列舉的物件類型及列舉類型,然後按一下 [確定]。If you click Browse, in the Select SMO Enumeration dialog box, select the object type to enumerate and the enumeration type, and click OK.

  6. (選擇性) 按一下 [集合] 頁面上 [運算式] 文字方塊中的瀏覽按鈕 (…),以建立更新屬性值的運算式。Optionally, click the browse button (…) in the Expressions text box on the Collection page to create expressions that update property values. 如需詳細資訊,請參閱加入或變更屬性運算式For more information, see Add or Change a Property Expression.

    注意

    [屬性] 清單中列出的屬性會依列舉值而不同。The properties listed in the Property list varies by enumerator.

  7. (選擇性) 按一下 [變數對應],以將物件屬性對應至集合值,然後執行下列操作:Optionally, click Variable Mappings to map object properties to the collection value, and then do the following:

    1. 變數清單中,選取變數,或按一下<新增變數 >以建立新的變數。In the Variables list, select a variable or click <New Variable> to create a new variable.

    2. 如果您加入新的變數,請在 [加入變數] 對話方塊中設定變數屬性,然後按一下 [確定]。If you add a new variable, set the variable properties in the Add Variable dialog box and click OK.

    3. 如果您使用 ForEach 項目列舉值,則可以在 [索引] 清單中更新索引值。If you use the For Each Item enumerator, you can update the index value in the Index list.

      注意

      索引值指示項目中要對應至變數的資料行。The index value indicates which column in the item to map to the variable. 只有「For Each 項目」列舉值可以使用 0 之外的索引值。Only the For Each Item enumerator can use an index value other than 0.

  8. (選擇性) 按一下 [運算式] 頁面上的 [運算式],建立 Foreach 迴圈容器之屬性的屬性運算式。Optionally, click Expressions and, on the Expressions page, create property expressions for the properties of the Foreach Loop container. 如需詳細資訊,請參閱加入或變更屬性運算式For more information, see Add or Change a Property Expression.

  9. 按一下 [確定]Click OK.

[一般] 頁面-Foreach 迴圈編輯器General Page - Foreach Loop Editor

使用 [Foreach 迴圈編輯器] 對話方塊的 [一般] 頁面,即可命名並描述 Foreach 迴圈容器,使用指定的列舉值為集合的每一個成員重複工作流程。Use the General page of the Foreach Loop Editor dialog box to name and describe a Foreach Loop container that uses a specified enumerator to repeat a workflow for each member in a collection.

若要了解 Foreach 迴圈容器以及如何設定該容器,請參閱 Foreach 迴圈容器設定 Foreach 迴圈容器To learn about the Foreach Loop container and how to configure it, see Foreach Loop Container and Configure a Foreach Loop Container.

選項。Options

名稱Name
為 Foreach 迴圈容器提供唯一的名稱。Provide a unique name for the Foreach Loop container. 此名稱會用於工作圖示和記錄中的標籤。This name is used as the label in the task icon and in the logs.

注意

物件名稱在封裝內必須是唯一的。Object names must be unique within a package.

描述Description
輸入 Foreach 迴圈容器的描述。Type a description of the Foreach Loop container.

集合頁面-Foreach 迴圈編輯器Collection Page - Foreach Loop Editor

使用 [Foreach 迴圈編輯器] 對話方塊的 [集合] 頁面,即可指定列舉值類型和設定列舉值。Use the Collection pageof the Foreach Loop Editor dialog box to specify the enumerator type and configure the enumerator.

若要了解 Foreach 迴圈容器以及如何設定該容器,請參閱 Foreach 迴圈容器設定 Foreach 迴圈容器To learn about the Foreach Loop container and how to configure it, see Foreach Loop Container and Configure a Foreach Loop Container.

靜態選項Static Options

列舉值Enumerator
從清單中選取列舉值類型。Select the enumerator type from the list. 這個屬性具有下表中所列的選項。This property has the options listed in the following table.

ValueValue DescriptionDescription
Foreach 檔案列舉值Foreach File Enumerator 列舉檔案。Enumerate files. 選取這個值就會在 [Foreach 檔案列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach File Enumerator.
Foreach 項目列舉值Foreach Item Enumerator 列舉項目中的值。Enumerate values in an item. 選取這個值就會在 [Foreach 項目列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach Item Enumerator.
Foreach ADO 列舉值Foreach ADO Enumerator 列舉資料表或資料表中的資料列。Enumerate tables or rows in tables. 選取這個值就會在 [Foreach ADO 列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach ADO Enumerator.
Foreach ADO.NET 結構描述資料列集列舉值Foreach ADO.NET Schema Rowset Enumerator 列舉結構描述。Enumerate a schema. 選取這個值就會在 [Foreach ADO.NET 列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach ADO.NET Enumerator.
Foreach From Variable 列舉值Foreach From Variable Enumerator 列舉變數中的值。Enumerate the value in a variable. 選取這個值就會在 [Foreach From Variable 列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach From Variable Enumerator.
Foreach Nodelist 列舉值Foreach Nodelist Enumerator 以 XML 文件列舉節點。Enumerate nodes in an XML document. 選取這個值就會在 [Foreach NodeList 列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach Nodelist Enumerator.
Foreach SMO 列舉值Foreach SMO Enumerator 列舉 SMO 物件。Enumerate a SMO object. 選取這個值就會在 [Foreach SMO 列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach SMO Enumerator.
Foreach HDFS 檔案列舉值Foreach HDFS File Enumerator 列舉所指定 HDFS 位置中的 HDFS 檔案。Enumerate HDFS files in the specified HDFS location. 選取這個值就會在 [Foreach HDFS 檔案列舉值] 區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach HDFS File Enumerator.
Foreach Azure Blob 列舉值Foreach Azure Blob Enumerator 列舉指定 Blob 位置中的 Blob 檔案。Enumerate blob files in the specified blob location. 選取此值可在 [Foreach ADO 列舉值]區段中顯示動態選項。Selecting this value displays the dynamic options in the section, Foreach Azure Blob Enumerator.
ADLS Foreach 檔案列舉值Foreach ADLS File Enumerator 列舉 ADLS 上具有篩選條件的檔案。Enumerate files on ADLS with filters. 選取此值區段中顯示動態選項Foreach ADLS 檔案列舉值Selecting this value displays the dynamic options in the section, Foreach ADLS File Enumerator.

運算式Expressions
按一下或展開 [運算式] ,即可檢視現有屬性運算式的清單。Click or expand Expressions to view the list of existing property expressions. 按一下省略符號 (...) 按鈕以加入列舉值屬性的屬性運算式,或是編輯和評估現有的屬性運算式。Click the ellipsis button (…) to add a property expression for an enumerator property, or edit and evaluate an existing property expression.

相關主題Integration Services (SSIS) 運算式屬性運算式編輯器運算式產生器Related Topics: Integration Services (SSIS) Expressions, Property Expressions Editor, Expression Builder

列舉值動態選項Enumerator Dynamic Options

列舉值 = Foreach 檔案列舉值Enumerator = Foreach File Enumerator

Foreach 檔案列舉值可用來列舉資料夾中的檔案。You use the Foreach File enumerator to enumerate files in a folder. 例如,如果 Foreach 迴圈包括「執行 SQL」工作,則您可使用 Foreach 檔案列舉值來列舉檔案,而這些檔案包含執行「執行 SQL」工作的 SQL 陳述式。For example, if the Foreach Loop includes an Execute SQL task, you can use the Foreach File enumerator to enumerate files that contain SQL statements that the Execute SQL task runs. 您也可以將列舉值設定成包括子資料夾。The enumerator can be configured to include subfolders.

因為迴圈中的外部處理序或工作在迴圈執行時加入、重新命名或刪除檔案,所以 Foreach 檔案列舉值所列舉的資料夾和子資料夾內容在迴圈執行時可能會變更。The content of the folders and subfolders that the Foreach File enumerator enumerates might change while the loop is executing because external processes or tasks in the loop add, rename, or delete files while the loop is executing. 這表示可能會發生一些非預期的狀況:This means that a number of unexpected situations may occur:

  • 如果是刪除檔案,則 Foreach 迴圈中的其中一個工作可能會針對與後續工作所用之檔案不同的一組檔案執行工作。If files are deleted, one task in the Foreach Loop may perform work on a different set of files than the files used by subsequent tasks.

  • 如果是重新命名檔案,且外部處理序自動加入檔案以取代重新命名的檔案,則 Foreach 迴圈可能會針對相同的檔案內容執行兩次工作。If files are renamed and an external process automatically adds files to replace the renamed files, the Foreach Loop might perform work twice on the same file content.

  • 如果是加入檔案,則可能會很難判斷 Foreach 迴圈執行的是哪個檔案的工作。If files are added, it may be difficult to determine for which files the Foreach Loop performed work.

    資料夾Folder
    提供要列舉的根資料夾之路徑。Provide the path of the root folder to enumerate.

    瀏覽Browse
    瀏覽以尋找根資料夾。Browse to locate the root folder.

    檔案Files
    指定要列舉的檔案。Specify the files to enumerate.

注意

使用萬用字元 () 即可指定要包含在集合中的檔案。Use wildcard characters () to specify the files to include in the collection. 例如,若要包括名稱內含 "abc" 的檔案,可使用下列篩選: *abc*。For example, to include files with names that contain “abc”, use the following filter: *abc*.

當您指定副檔名時,此列舉值也會傳回附加其他字元之相同副檔名的檔案When you specify a file name extension, the enumerator also returns files that have the same extension with additional characters appended. (這個行為與作業系統中 dir 命令的行為相同,而且此命令也會針對回溯相容性比較 8.3 檔案名稱)。列舉值的這個行為可能會導致非預期的結果。(This is the same behavior as that of the dir command in the operating system, which also compares 8.3 file names for backward compatibility.) This behavior of the enumerator could cause unexpected results. 例如,您只想要列舉 Excel 2003 檔案,而且指定了 ".xls"。For example, you want to enumerate only Excel 2003 files, and you specify ".xls". 不過,此列舉值也會傳回 Excel 2007 檔案,因為這些檔案的副檔名為 ".xlsx"。However, the enumerator will also return Excel 2007 files because those files have the extension, ".xlsx".

您可以使用運算式指定要包括在集合內的檔案,方法是展開 [集合] 頁面上的 [運算式],選取 FileSpec 屬性,然後按一下省略符號按鈕 (…) 加入屬性運算式。You can use an expression to specify the files to include in a collection, by expanding Expressions on the Collection page, selecting the FileSpec property, and then clicking the ellipsis button (…) to add the property expression.

完整Fully qualified
選取即可擷取檔案名稱的完整路徑。Select to retrieve the fully qualified path of file names. 如果在檔案選項中指定萬用字元,則會傳回符合篩選的完整路徑。If wildcard characters are specified in the Files option, then the fully-qualified paths that are returned match the filter.

僅名稱Name only
選取即可只擷取檔案名稱。Select to retrieve only the file names. 如果在檔案選項中指定萬用字元,則會傳回符合篩選的檔案名稱。If wildcard characters are specified in the Files option, then the file names returned match the filter.

名稱和副檔名Name and extension
選取即可擷取檔案名稱及其副檔名。Select to retrieve the file names and their file name extensions. 如果在檔案選項中指定萬用字元,則會傳回符合篩選的檔案名稱和副檔名。If wildcard characters are specified in the Files option, then the name and extension of files returned match the filter.

周遊子資料夾Traverse Subfolders
選取即可在列舉中包含子資料夾。Select to include the subfolders in the enumeration.

列舉值 = Foreach 項目列舉值Enumerator = Foreach Item Enumerator

Foreach 項目列舉值可用來列舉集合中的項目。You use the Foreach Item enumerator to enumerate items in a collection. 您指定資料行和資料行值,即可定義集合中的項目。You define the items in the collection by specifying columns and column values. 一個資料列中的所有資料行都可定義項目。The columns in a row define an item. 例如,指定用來執行「執行處理」工作之可執行檔及該工作所使用之工作目錄的項目會有兩個資料行,一個會列出可執行檔名稱,而另一個會列出工作目錄。For example, an item that specifies the executables that an Execute Process task runs and the working directory that the task uses has two columns, one that lists the names of executables and one that lists the working directory. 資料列數目會決定迴圈的重複次數。The number of rows determines the number of times that the loop is repeated. 如果資料表有 10 個資料列,則迴圈會重複 10 次。If the table has 10 rows, the loop repeats 10 times.

若要更新執行處理工作的屬性,則使用資料行的索引,您可以將變數對應至項目資料行。To update the properties of the Execute Process task, you map variables to item columns by using the index of the column. 列舉值項目中所定義之第一個資料行的索引值為 0,第二個資料行則為 1,以此類推。The first column defined in the enumerator item has the index value 0, the second column 1, and so on. 每次重複迴圈時,都會更新變數值。The variable values are updated with each repeat of the loop. Executable 然後,會透過使用這些變數的屬性運算式來更新「執行處理」工作的 WorkingDirectory 和 屬性。The Executable and WorkingDirectory properties of the Execute Process task can then be updated by property expressions that use these variables.

定義 For Each 項目集合中的項目Define the items in the For Each Item collection
提供資料表中每個資料行的值。Provide a value for each column in the table.

注意

在資料列資料行輸入值之後,就會在資料表中自動加入新的資料列。A new row is automatically added to the table after you enter values in row columns.

注意

如果提供的值與資料行資料類型不相容,文字就會以紅色顯示。If the values provided are not compatible with the column data type, the text is colored red.

資料行資料類型Column data type
列出使用中資料行的資料類型。Lists the data type of the active column.

移除Remove
選取項目,然後按一下 [移除] 即可從清單中移除。Select an item, and then click Remove to remove it from the list.

資料行Columns
按一下即可在項目中設定資料行的資料類型。Click to configure the data type of the columns in the item.

相關主題 For Each 項目資料行對話方塊 UI 參考Related Topics: For Each Item Columns Dialog Box UI Reference

列舉值 = Foreach ADO 列舉值Enumerator = Foreach ADO Enumerator

Foreach ADO 列舉值可用來列舉 ADO 或 ADO.NET 物件中的資料列或資料表,而這類物件是儲存在變數中。You use the Foreach ADO enumerator to enumerate rows or tables in an ADO or ADO.NET object that is stored in a variable. 例如,如果 Foreach 迴圈包括將資料集寫入變數的指令碼工作,您可以使用 Foreach ADO 列舉值來列舉該資料集中的資料列。For example, if the Foreach Loop includes a Script task that writes a dataset to a variable, you can use the Foreach ADO enumerator to enumerate the rows in the dataset. 如果變數包含 ADO.NET 資料集,則可將列舉值設定成列舉多個資料表中的資料列,或設定成列舉資料表。If the variable contains an ADO.NET dataset, the enumerator can be configured to enumerate rows in multiple tables or to enumerate tables.

ADO 物件來源變數ADO object source variable
在清單中,選取的使用者自訂變數,或按一下<新增變數...> 若要建立新的變數。Select a user-defined variable in the list, or click <New variable...> to create a new variable.

注意

變數必須為物件資料類型,否則會發生錯誤。The variable must have the Object data type, otherwise an error occurs.

相關主題Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables, Add Variable

第一個資料表中的資料列Rows in first table
選取此選項即可只列舉第一個資料表的資料列。Select to enumerate only rows in the first table.

(僅 ADO.NET 資料集) 的所有資料表中的資料列Rows in all tables (ADO.NET dataset only)
選取即可列舉所有資料表的資料列。Select to enumerate rows in all tables. 唯有所有列舉的物件都是相同 ADO.NET 資料集的成員時,才可以使用此選項。This option is available only if the objects to enumerate are all members of the same ADO.NET dataset.

所有資料表 (僅 ADO.NET 資料集)All tables (ADO.NET dataset only)
選取即可只列舉資料表。Select to enumerate tables only.

列舉值 = Foreach ADO.NET 結構描述資料列集列舉值Enumerator = Foreach ADO.NET Schema Rowset Enumerator

Foreach ADO.NET 結構描述資料列集列舉值可用來列舉所指定之資料來源的結構描述。You use the Foreach ADO.NET Schema Rowset enumerator to enumerate a schema for a specified data source. 例如,如果 Foreach 迴圈包括「執行 SQL」工作,您可以使用 Foreach ADO.NET 結構描述資料列集列舉值來列舉結構描述 (例如 AdventureWorks 資料庫中的資料行),以及使用「執行 SQL」工作來取得結構描述權限。For example, if the Foreach Loop includes an Execute SQL task, you can use the Foreach ADO.NET Schema Rowset enumerator to enumerate schemas such as the columns in the AdventureWorks database, and the Execute SQL task to get the schema permissions.

連接Connection
在清單中,選取 ADO.NET 連接管理員,或按一下<新增連接...> 以建立新的 ADO.NET 連接管理員。Select an ADO.NET connection manager in the list, or click <New connection...> to create a new ADO.NET connection manager.

重要

ADO.NET 連接管理員必須使用 OLE DB 的 .NET 提供者。The ADO.NET connection manager must use a .NET provider for OLE DB. 如果連接到 SQL Server,則建議使用的提供者是 SQL ServerSQL Server Native Client,會列在 [連接管理員] 對話方塊的 [OleDb 的 .Net 提供者] 區段中。If connecting to SQL Server, the recommended provider to use is the SQL ServerSQL Server Native Client, listed in the .Net Providers for OleDb section of the Connection Manager dialog box.

相關主題 ADO Connection ManagerConfigure ADO.NET Connection ManagerRelated Topics: ADO Connection Manager, Configure ADO.NET Connection Manager

結構描述Schema
選取要列舉的結構描述。Select the schema to enumerate.

設定限制Set Restrictions
設定要套用至指定之結構描述的限制。Set the restrictions to apply to the specified schema.

相關主題 結構描述限制對話方塊Related Topics: Schema Restrictions Dialog Box

列舉值 = Foreach From Variable 列舉值Enumerator = Foreach From Variable Enumerator

Foreach From Variable 列舉值可用來列舉所指定之變數中可列舉的物件。You use the Foreach From Variable enumerator to enumerate the enumerable objects in the specified variable. 例如,如果 Foreach 迴圈包括執行查詢並將結果儲存在變數中的「執行 SQL」工作,您可以使用 Foreach From Variable 列舉值來列舉查詢結果。For example, if the Foreach Loop includes an Execute SQL task that runs a query and stores the result in a variable, you can use the Foreach From Variable enumerator to enumerate the query results.

變數Variable
在清單中,選取變數,或按一下<新增變數...> 若要建立新的變數。Select a variable in the list, or click <New variable...> to create a new variable.

相關主題Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables, Add Variable

列舉值 = Foreach NodeList 列舉值Enumerator = Foreach NodeList Enumerator

Foreach Nodelist 列舉值可用來列舉因為將 XPath 運算式套用至 XML 檔案而產生的 XML 節點集合。You use the Foreach Nodelist enumerator to enumerate the set of XML nodes that results from applying an XPath expression to an XML file. 例如,如果 Foreach 迴圈包括指令碼工作,則您可使用 Foreach NodeList 列舉值將符合 XPath 運算式條件的值從 XML 檔案傳送給該指令碼工作。For example, if the Foreach Loop includes a Script task, you can use the Foreach NodeList enumerator to pass a value that meets the XPath expression criteria from the XML file to the Script task.

套用至 XML 檔案的 XPath 運算式就是儲存在 OuterXPathString 屬性中的外部 XPath 作業。The XPath expression that applies to the XML file is the outer XPath operation, stored in the OuterXPathString property. 如果 XPath 列舉類型設定為 [ElementCollection],則 Foreach NodeList 列舉值可將儲存在 InnerXPathString 屬性中的內部 XPath 運算式套用至元素集合。If the XPath enumeration type is set to ElementCollection, the Foreach NodeList enumerator can apply an inner XPath expression, stored in the InnerXPathString property, to a collection of element.

若要深入了解 XML 文件和資料,請參閱 MSDN Library 中的在 .NET Framework 內採用 XMLTo learn more about working with XML documents and data, see "Employing XML in the .NET Framework" in the MSDN Library.

DocumentSourceTypeDocumentSourceType
選取 XML 文件的來源類型。Select the source type of the XML document. 這個屬性具有下表中所列的選項。This property has the options listed in the following table.

ValueValue 說明Description
直接輸入Direct input 設定 XML 文件的來源。Set the source to an XML document.
檔案連接File connection 選取包含 XML 文件的檔案。Select a file that contains the XML document.
變數Variable 設定包含 XML 文件的變數來源。Set the source to a variable that contains the XML document.

DocumentSourceDocumentSource
如果 [DocumentSourceType] 設定為 [直接輸入],請提供 XML 程式碼,或按一下省略符號 (...) 按鈕,以使用 [文件來源編輯器] 對話方塊來提供 XML。If DocumentSourceType is set to Direct input, provide the XML code, or click the ellipsis (…) button to provide XML by using the Document Source Editor dialog box.

如果DocumentSourceType檔案連接,選取檔案連接管理員,或按一下<新增連接...> 以建立新的連接管理員。If DocumentSourceType is set to File connection, select a File connection manager, or click <New connection...> to create a new connection manager.

相關主題: File Connection ManagerFile Connection Manager EditorRelated Topics: File Connection Manager, File Connection Manager Editor

如果DocumentSourceType變數,選取現有的變數,或按一下<新增變數...> 若要建立新的變數。If DocumentSourceType is set to Variable, select an existing variable, or click <New variable...> to create a new variable.

相關主題Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables, Add Variable.

EnumerationTypeEnumerationType
從清單中選取列舉類型。Select an enumeration type from the list. 這個屬性具有下表中所列的選項。This property has the options listed in the following table.

ValueValue DescriptionDescription
導覽器Navigator 使用 XPathNavigator 列舉。Enumerate using an XPathNavigator.
節點Node 列舉 XPath 作業傳回的節點。Enumerate nodes returned by an XPath operation.
節點文字NodeText 列舉 XPath 作業傳回的文字節點。Enumerate text nodes returned by an XPath operation.
ElementCollectionElementCollection 列舉 XPath 作業傳回的元素節點。Enumerates element nodes returned by an XPath operation.

OuterXPathStringSourceTypeOuterXPathStringSourceType
選取 XPath 字串的來源類型。Select the source type of the XPath string. 這個屬性具有下表中所列的選項。This property has the options listed in the following table.

ValueValue 說明Description
直接輸入Direct input 設定 XML 文件的來源。Set the source to an XML document.
檔案連接File connection 選取包含 XML 文件的檔案。Select a file that contains the XML document.
變數Variable 設定包含 XML 文件的變數來源。Set the source to a variable that contains the XML document.

OuterXPathStringOuterXPathString
如果 [OuterXPathStringSourceType] 設定為 [直接輸入],請提供 XPath 字串。If OuterXPathStringSourceType is set to Direct input, provide the XPath string.

如果OuterXPathStringSourceType檔案連接,選取檔案連接管理員,或按一下<新增連接...> 以建立新的連接管理員。If OuterXPathStringSourceType is set to File connection, select a File connection manager, or click <New connection...> to create a new connection manager.

相關主題: File Connection ManagerFile Connection Manager EditorRelated Topics: File Connection Manager, File Connection Manager Editor

如果OuterXPathStringSourceType變數,選取現有的變數,或按一下<新增變數...> 若要建立新的變數。If OuterXPathStringSourceType is set to Variable, select an existing variable, or click <New variable...> to create a new variable.

相關主題Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables, Add Variable.

InnerElementTypeInnerElementType
如果 [EnumerationType] 設定為 [ElementCollection],請在清單中選取內部元素的類型。If EnumerationType is set to ElementCollection, select the type of inner element in the list.

InnerXPathStringSourceTypeInnerXPathStringSourceType
選取內部 XPath 字串的來源類型。Select the source type of the inner XPath string. 這個屬性具有下表中所列的選項。This property has the options listed in the following table.

ValueValue 說明Description
直接輸入Direct input 設定 XML 文件的來源。Set the source to an XML document.
檔案連接File connection 選取包含 XML 文件的檔案。Select a file that contains the XML document.
變數Variable 設定包含 XML 文件的變數來源。Set the source to a variable that contains the XML document.

InnerXPathStringInnerXPathString
如果 [InnerXPathStringSourceType] 設定為 [直接輸入],請提供 XPath 字串。If InnerXPathStringSourceType is set to Direct input, provide the XPath string.

如果InnerXPathStringSourceType檔案連接,選取檔案連接管理員,或按一下<新增連接...> 以建立新的連接管理員。If InnerXPathStringSourceType is set to File connection, select a File connection manager, or click <New connection...> to create a new connection manager.

相關主題: File Connection ManagerFile Connection Manager EditorRelated Topics: File Connection Manager, File Connection Manager Editor

如果InnerXPathStringSourceType變數,選取現有的變數,或按一下<新增變數...> 若要建立新的變數。If InnerXPathStringSourceType is set to Variable, select an existing variable, or click <New variable...> to create a new variable.

相關主題Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables, Add Variable.

列舉值 = Foreach SMO 列舉值Enumerator = Foreach SMO Enumerator

Foreach SMO 列舉值可用來列舉 SQL Server 管理物件 (SMO) 物件。You use the Foreach SMO enumerator to enumerate SQL Server Management Object (SMO) objects. 例如,如果 Foreach 迴圈包括「執行 SQL」工作,您可以使用 Foreach SMO 列舉值來列舉 AdventureWorks 資料庫中的資料表,並執行用來計算每個資料表中資料列數目的查詢。For example, if the Foreach Loop includes an Execute SQL task, you can use the Foreach SMO enumerator to enumerate the tables in the AdventureWorks database and run queries that counts the number of rows in each table.

連接Connection
選取現有的 ADO.NET 連接管理員,或按一下<新增連接...> 以建立新的連接管理員。Select an existing ADO.NET connection manager, or click <New connection...> to create a new connection manager.

ADO.NET Connection Manager, Configure ADO.NET Connection ManagerRelated Topics: ADO.NET Connection Manager, Configure ADO.NET Connection Manager

列舉Enumerate
指定要列舉的 SMO 物件。Specify the SMO object to enumerate.

瀏覽Browse
選取 SMO 列舉。Select the SMO enumeration.

相關主題選取 SMO 列舉對話方塊Related Topics: Select SMO Enumeration Dialog Box

列舉值 = Foreach HDFS 檔案列舉值 Enumerator = Foreach HDFS File Enumerator

[Foreach HDFS 檔案列舉值] 可讓 SSIS 封裝列舉所指定 HDFS 位置中的 HDFS 檔案。The Foreach HDFS File Enumerator enables an SSIS package to enumerate HDFS files in the specified HDFS location. 每個 HDFS 檔案的名稱可以儲存在變數中,也可以用於 Foreach 迴圈容器內的工作中。The name of each HDFS file can be stored in a variable and used in tasks inside the Foreach Loop Container.

Hadoop 連線管理員Hadoop Connection Manager
指定現有的 Hadoop 連線管理員或建立新的連線管理員,這個連線管理員指向 HDFS 檔案的裝載位置。Specify an existing Hadoop Connection Manager or create a new one, which points to where the HDFS files are hosted. 如需詳細資訊,請參閱< Hadoop Connection Manager>。For more info, see Hadoop Connection Manager.

目錄路徑Directory Path
指定包含要列舉之 HDFS 檔案的 HDFS 目錄名稱。Specify the name of the HDFS directory that contains the HDFS files to be enumerated.

檔案名稱篩選File name filter
指定名稱篩選,以選取具有特定名稱模式的檔案。Specify a name filter to select files with a certain name pattern. 例如,MySheet.xls\ 會包含 MySheet001.xls 和 MySheetABC.xlsx 這類的檔案。For example, MySheet.xls\ will include files such as MySheet001.xls and MySheetABC.xlsx.

擷取檔案名稱Retrieve file name
指定 SSIS 所擷取的檔案名稱類型。Specify the file name type retrieved by SSIS.

  • [完整名稱] 表示包含目錄路徑和檔案名稱的完整名稱。Fully qualified name means the full name which contains the directory path and file name.

  • [只有名稱] 表示僅擷取檔案名稱。Name only means only the file name is retrieved.

    周遊子資料夾Traverse subfolders
    指定是否要遞迴地循環使用子資料夾。Specify whether to loop through subfolders recursively.

    在編輯器的 [變數對應] 頁面上,選取或建立變數來儲存所列舉 HDFS 檔案的名稱。On the Variable Mappings page of the editor, select or create a variable to store the name of the enumerated HDFS file.

列舉值 = Foreach Azure Blob 列舉值 Enumerator = Foreach Azure Blob Enumerator

[Azure Blob Enumerator (Azure Blob 列舉值)] 可讓 SSIS 封裝列舉所指定 Blob 位置中的 Blob 檔案。The Azure Blob Enumerator enables an SSIS package to enumerate blob files in the specified blob location. 列舉之 Blob 檔案的名稱可以儲存在變數中,也可以用於 Foreach 迴圈容器中的工作中。The name of enumerated blob file can be stored in a variable and used in tasks inside the Foreach Loop Container.

[Azure Blob Enumerator (Azure Blob 列舉值)] 是適用於 SQL Server 2016SQL Server 2016 之 Azure SQL Server Integration Services (SSIS) 功能套件的元件。The Azure Blob Enumerator is a component of the SQL Server Integration Services (SSIS) Feature Pack for Azure for SQL Server 2016SQL Server 2016. 請在 這裡Download the Feature Pack here.

Azure 儲存體連線管理員Azure storage connection manager
選取現有的 Azure 儲存體連接管理員,或建立參考 Azure 儲存體帳戶的新連接管理員。Select an existing Azure Storage Connection Manager or create a new one that refers to an Azure Storage Account.

相關主題: Azure 儲存體連線管理員Related Topics: Azure Storage Connection Manager.

Blob 容器名稱Blob container name
指定包含要列舉之 Blob 檔案的 Blob 容器之名稱。Specify the name of the blob container that contains the blob files to be enumerated..

Blob 目錄Blob directory
指定指定包含要列舉之 Blob 檔案的 Blob 目錄。Specify the specify the blob directory that contains the blob files to be enumerated. Blob 目錄是虛擬的階層式結構。The blob directory is a virtual hierarchical structure.

Blob 名稱篩選條件Blob name filter
指定名稱篩選條件以列舉具有特定名稱模式的檔案。Specify a name filter to enumerate files with a certain name pattern. 例如E.g. MySheet.xls\ 會包含 MySheet001.xls 及 MySheetABC.xlsx 一類的檔案。MySheet.xls\ will include files such as MySheet001.xls and MySheetABC.xlsx.

Blob 自/至篩選的時間範圍Blob time range from/to filter
指定時間範圍篩選條件。Specify a time range filter. 這會列舉在 TimeRangeFrom 之後及在 TimeRangeTo 之前修改的檔案。Files modified after TimeRangeFrom and before TimeRangeTo will be enumerated.

列舉值 = Foreach ADLS 檔案列舉值 Enumerator = Foreach ADLS File Enumerator

ADLS 檔案列舉值可讓 SSIS 封裝列舉 ADLS 上具有篩選條件的檔案。The ADLS File Enumerator enables an SSIS package to enumerate files on ADLS with filters. 斜線 (/)-帶有前置詞的完整路徑的列舉檔案可以儲存在變數中,並用於 Foreach 迴圈容器中的工作。The slash (/)-prefixed full path of enumerated files can be stored in a variable and used in tasks inside the Foreach Loop Container.

AzureDataLakeConnectionAzureDataLakeConnection
指定的 Azure 資料湖連接管理員,或建立參考 ADLS 帳戶的新連線。Specifies an Azure Data Lake connection manager, or creates a new one that refers to an ADLS account.

AzureDataLakeDirectoryAzureDataLakeDirectory
指定要搜尋的 ADLS 目錄。Specifies the ADLS directory to search.

FileNamePatternFileNamePattern
指定檔案名稱篩選條件。Specifies a file name filter. 會列舉其名稱符合指定的模式的檔案。Only files whose name matches the specified pattern will be enumerated. 萬用字元*?支援。Wildcards * and ? are supported.

SearchRecursivelySearchRecursively
指定是否要搜尋以遞迴方式在指定的目錄。Specifies whether to search recursively within the specified directory.

Foreach 迴圈編輯器變數對應頁面Variable Mappings Page - Foreach Loop Editor

使用 [Foreach 迴圈編輯器] 對話方塊的 [變數對應] 頁面,即可將變數對應至集合值。Use the Variables Mappings page of the Foreach Loop Editor dialog box to map variables to the collection value. 會用迴圈之每個反覆運算上的集合值來更新變數的值。The value of the variable is updated with the collection values on each iteration of the loop.

若要了解如何在 Integration Services 封裝中使用「Foreach 迴圈」容器,請參閱 Foreach 迴圈容器To learn about how to use the Foreach Loop container in an Integration Services package, see Foreach Loop Container . 若要了解如何設定此容器,請參閱 設定 Foreach 迴圈容器To learn about how to configure it, see Configure a Foreach Loop Container.

MicrosoftMicrosoft SQL ServerSQL Server Integration ServicesIntegration Services 教學課程中的<建立簡易 ETL 封裝教學課程>包含了一門教您加入和設定「Foreach 迴圈」的課程。The MicrosoftMicrosoft SQL ServerSQL Server Integration ServicesIntegration Services tutorial, Creating a Simple ETL Package Tutorial, includes a lesson that teaches you to add and configure a Foreach Loop.

選項Options

變數Variable
選取現有的變數,或按一下<新增變數...> 若要建立新的變數。Select an existing variable, or click <New variable...> to create a new variable.

注意

對應變數之後,新資料列會自動加入 [變數] 清單。After you map a variable, a new row is automatically added to the Variable list.

相關主題Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables, Add Variable

索引Index
如果使用 Foreach 項目列舉值,請指定集合值中要對應至變數的資料行索引。If using the Foreach Item enumerator, specify the index of the column in the collection value to map to the variable. 針對其他列舉值類型,此索引是唯讀的。For other enumerator types, the index is read-only.

注意

索引是以 0 為基底。The index is 0-based.

DeleteDelete
選取變數,然後按一下 [刪除]。Select a variable, and then click Delete.

結構描述限制對話方塊 (ADO.NET)Schema Restrictions dialog box (ADO.NET)

使用 [結構描述限制] 對話方塊,即可設定要套用至 Foreach ADO.NET 結構描述資料列集列舉值的結構描述限制。Use the Schema Restrictions dialog box to set the schema restrictions to apply to the Foreach ADO.NET Schema Rowset enumerator.

選項。Options

限制Restrictions
選取要套用至結構描述的條件約束。Select the constraints to apply to the schema.

變數Variable
使用變數以定義限制。Use a variable to define restrictions. 在清單中選取變數,或按一下 [<新增變數>],以建立新的變數。Select a variable in the list, or click New variable... to create a new variable.

相關主題:Integration Services (SSIS) 變數加入變數Related Topics: Integration Services (SSIS) Variables , Add Variable

文字Text
提供文字以定義限制。Provide the text to define restrictions.

For Each 項目資料行對話方塊For Each Item Columns dialog box

使用 [For Each 項目資料行] 對話方塊,即可定義項目中 Foreach 項目列舉值會列舉的資料行。Use the For Each Item Columns dialog box to define the columns in the items that the Foreach Item enumerator enumerates.

選項。Options

資料行Column
列出資料行。Lists the columns.

資料類型Data Type
選取資料類型。Select the data type.

加入Add
加入新資料行。Add a new column.

移除Remove
選取資料行,然後按一下 [移除]。Select a column, and then click Remove.

選取 SMO 列舉對話方塊Select SMO Enumeration dialog box

使用 [選取 SMO 列舉] 對話方塊,即可在指定的 SQL ServerSQL Server 執行個體上指定 SQL ServerSQL Server 管理物件 (SMO) 物件,以列舉和選取列舉類型。Use the Select SMO Enumeration dialog box to specify the SQL ServerSQL Server Management Objects (SMO) object on the specified instance of SQL ServerSQL Server to enumerate, and to select the enumeration type.

選項Options

列舉Enumerate
展開伺服器並選取 SMO 物件。Expand the server and select the SMO object.

物件Objects
使用物件列舉類型。Use the Objects enumeration type.

預先填入Prepopulate
使用 [預先擴展] 選項與物件列舉類型搭配使用。Use the Prepopulate option with the Objects enumeration type.

名稱Names
使用名稱列舉類型。Use the Names enumeration type.

UrnURNs
使用 URN 列舉類型。Use the URNs enumeration type.

位置Locations
使用位置列舉類型。Use the Locations enumeration type. 此選項僅適用於檔案。This option is available only for files.

使用 「 Foreach 迴圈 」 容器使用屬性運算式Use property expressions with Foreach Loop containers

封裝可以設定成同時執行多個可執行檔。Packages can be configured to concurrently run multiple executables. 當封裝包含實作屬性運算式的「Foreach 迴圈」容器時,請謹慎使用這項組態。This configuration should be used with caution when the package includes a Foreach Loop container that implements property expressions.

實作屬性運算式通常非常適合用來設定「Foreach 迴圈」列舉值所使用之連線管理員的 ConnectionString 屬性值。It is often useful to implement a property expression to set the value of the ConnectionString property of the connection managers that the Foreach Loop enumerators use. ConnectionString 的屬性運算式是由對應至列舉值之集合值的變數加以設定,並於迴圈的每個反覆運算中進行更新。The property expression of ConnectionString is set by a variable that maps to the collection value of the enumerator and is updated at each iteration of the loop.

為了避免可執行檔平行執行時機不確定的負面影響,您應該將封裝設定為一次只執行一個可執行檔。To avoid negative consequences of nondeterminative timing of parallel execution of tasks in the loop, the package should be configured to run only one executable at a time. 例如,如果封裝可以同時執行多項工作,當執行 SQL 工作的兩個執行個體試圖同時進行寫入時,負責列舉資料夾中的檔案、擷取檔案名稱,然後使用執行 SQL 工作將檔案名稱插入資料表等步驟的「Foreach 迴圈」容器可能會引發寫入衝突。For example, if a package can run multiple tasks concurrently, a Foreach Loop container that enumerates files in the folder, retrieves the file names, and then uses an Execute SQL task to insert the file names into a table may incur write conflicts when two instances of the Execute SQL task attempt to write at the same time. 如需詳細資訊,請參閱 在封裝中使用屬性運算式For more information, see Use Property Expressions in Packages.

請參閱<See Also

控制流程 Control Flow
Integration Services 容器Integration Services Containers