ExecValueVariable usage of Execute Sql task

Source: Internet
Author: User
Tags rowcount ssis

The ExecValueVariable property specifies a variable that receives the ExecutionValue of a task and can be referenced in a downstream component.

Set the name of the custom variable that receives the execution result for the task. The default value of this property is None, and which indicates that the result isn't set to a variable in the package.

The TaskHost exposes the ExecutionValue property through the ExecValueVariable property. The task uses the ExecutionValue property to provide optional, and supplemental information about the results of execution. The ExecValueVariable property allows the user to map the ExecutionValue, the task returns to any variable that is vis Ible to the task. The package could then use the value returned as one of the criteria for determining the next task to run in the C Ontrol flow. For example, if a task deletes rows from a table as part of its Execute method, the task might return the number of rows D Eleted as the ExecutionValue. Clients of the task could then use this value to define expressions in precedence constraints between tasks.

The ExecutionValue property can is defined on the object Task and all tasks has this property. The best example perhaps are the Execute SQL Task which uses the ExecutionValue property to return the number of rows AFFEC Ted by the SQL statement (s). This could is a useful feature which you could often want to capture into a variable and using the result to do something El Se. We Cann ' t read the value of a task in runtime from SSIS and we can use execvaluevariable to get it.

The ExecValueVariable property exposed through, the task which lets us select a package variable. When the task sets the ExecutionValue, the actual value is copied to the variable we set on the execvaluevariable proper Ty and a variable is something we can access and does something with. So if is interested in ExecutionValue property then make sure you create a package variable and set the name as the ExecValueVariable.

In the Execute SQL task, use this property to specify a variable to receive the number of rows of data that are affected. Returns the number of rows affected by the SQL statement (s). The execvalue is using the @ @ROWCOUNT to assign the value of the variable and absent a @ @ROWCOUNT the value returned is-1 .

ExecValueVariable usage of sample Execute SQL task

UI for the 1,design package

The SQL statement for the Execute SQL task is that the value of the property execvaluevariable is a variable varcount

Insert  into dbo.delay_test VALUES (1), (2), (3)insert into dbo.delay_test  VALUES(2), (3)

The SQL statement for Task Insert data is that the passed in parameter is User::varcount

Insert  into dbo.dt_test Values (?)

2, viewing the result, the first Task returns the result is Varcount is 2, the result is actually @ @RowCount, SSIS after executing the statement, the @ @RowCount assigned to the Execute SQL Task The ExecValueVariable property is specified in the variable.

ExecValueVariable usage of Execute Sql task

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.