The Foreach Loop container usage for SSIS

Source: Internet
Author: User
Tags ssis

The business to be implemented: a database server on the T_goods_decl status field "Is_delete" labeled "1" When you delete the records in the T_goods_decl table of the corresponding library on the B database server, the primary key is "Decl_no".

Overall design, implementation principle: The previous step passes the result set to the Loop container, and the container takes the data line by row to execute the SQL task inside the container.

First step: Create a "get decl_no marked as deleted" Execute SQL task

Select the correct data connector.

Fill in the query SQL statement.

The result set option must select Full result set.

The result name in the result set corresponding must be set to "0" and the corresponding variable name will be created.

The new variable is of type object.

Step Two: Create a Foreach Loop container.

Select the foreach ADO enumerator.

The object source variable selects the previously defined Declnos.

Variable mappings, define the variables corresponding to the first column of data in the result set, which is at index 0.

Variables are defined as String types.

Step three: Create a "delete data by decl_no" Execution SQL task.

Select the correct data connector.

Fill in the Delete action SQL statement, "? "Represents a variable.

Select the correct variable name in the parameter map so that the "?" Receive the correct value.

When all settings are complete, click "Execute Package" to succeed.

The Foreach Loop container usage for SSIS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.