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