Result of Execute Sql Task how the DataSet returns

Source: Internet
Author: User
Tags ssis

The result dataset for Execute SQL task has the following four main types, and when Execute SQL task returns results, you need to use SSIS Variable to receive the data.

The data table code used in the example is as follows

Create Tabledbo.test (Codeint, namevarchar(Ten), txtNvarchar(Ten))Insert  intodbo.test (code,name,txt)Values(1,'a'N'b'),(2,'C'N'D'),(3,'e'N'F'),(4,'g'N'h')


1, when the result set is a single row, you need to define three variables to receive the data, the datatype of the variable to be consistent with the datatype of column, and the result The set specifies the mapping between the returned column and the received variable. In a downstream component, a variable is used to refer to the return value of the Execute SQL task.

2, when result set is full result set, the returned result set is replaced by the name, and the returned result set is stored in a variable of type object, which exists internally as a collection and holds the entire query result set.

Result name is 0, and the resulting set is stored in an object's SSIS variable.

3, how to use a variable of type object, the variable of type object is actually a dataset, each row of data is extracted and stored in a variable to be used by other components, so you must define SSIS Variable to hold the data.

In the foreach Loop component, Enumerator selects the foreach ADO Enumator and selects user::varobj in the ADO Object Source variable list.

Create three variables to hold the data, the data type of the variable is consistent with the data type of column in object, or SSIS will error.

In variable mappings, set the Ojbect column and the mapping,index=0 of the variable, representing the first column of object, using User::varcode to hold the first column of data, and so on.

Result of Execute Sql Task how the DataSet returns

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.