Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

Execute SQL Task in SSIS Full Row Set

by suresh

How to return Full row set (or Complete Table) from the SQL server using the SSIS Execute SQL Task with an example. It will also demonstrate the Result Set option Full Row Set. For this, we are going to use the Employee table present in the SQL Tutorial database

Before we start describing the Execute SQL Task in SSIS Full Row Set, Let me show you the SQL Server Employee Table that we use for this example:

Execute SQL Task in SSIS Full Row Set 1

Execute SQL Task in SSIS Full Row Set

In this example, we will use the SSIS Execute SQL Task full row set option to select the data present in the Employee table and save the returned result set in another table. To do so, Drag and drop the Execute SQL Task from SSIS toolbox to designer space.

Execute SQL Task in SSIS Full Row Set 2

Before we start configuring the Execute SQL Task, let me create variables that are required to hold the return records. And to do so, right-click on the design area will open the context menu. Please select the Variables option.

Execute SQL Task in SSIS Full Row Set 3

As you can see from the below screenshot, we created 8 variables. Here, the ResultSet variable of object type will hold the returned result set, and the remaining seven columns will use in another task.

Execute SQL Task in SSIS Full Row Set 4

Now, Double click on the Execute SQL Task Editor will open the Editor to configure it. Let me select the Connection Type as OLE DB Connection, which is connecting to the SQL Tutorial database. Next, we are using the Direct Input as the SQL statement so, click the … button to write the custom SQL command.

Execute SQL Task in SSIS Full Row Set 5

Please write your custom SQL statement here. As you can from the below screenshot, we are writing a Select statement to select all the records that are present in the Employee table.

-- SSIS Execute SQL Task Full Row Set Example
SELECT [FirstName]
      ,[LastName]
      ,[Education]
      ,[Occupation]
      ,[YearlyIncome]
      ,[Sales]
      ,[HireDate]
  FROM [Employee]
Execute SQL Task in SSIS Full Row Set 6

Please change the SSIS Execute SQL Task ResultSet property value from NONE (default) to the Full result set.

Execute SQL Task in SSIS Full Row Set 7

Next, go to the Result Set tab and click the Add button to assign the variables for the return set.

Execute SQL Task in SSIS Full Row Set 8

As we said before, the select statement will return a complete table. So, we are assigning object variable (ResultSet variable) as the result variable.

Execute SQL Task in SSIS Full Row Set 9

Until now, we successfully configure the execute SQL task. But, we intend to save the result set in the SQL database. To do so, we need a For Each Loop container. So, let me Drag and drop the Foreach Loop Container into the Control Flow region

Execute SQL Task in SSIS Full Row Set 10

Double click on it will open the Foreach Loop Editor to configure it. Please navigate yourself to the Collection tab, and select the Enumerator as the Foreach ADO Enumerator. Next, select the Object variable (ResultSet) as the ADO Object source. We will do one separate article for the Foreach ADO Enumerator so blindly follow the steps.

Execute SQL Task in SSIS Full Row Set 11

Next, we have to map the variables so navigate yourself to Variable Mappings tab.

Execute SQL Task in SSIS Full Row Set 12

Our ResultSet will return seven columns from the Employee table. So, we are assigning the previously created user variables to those seven columns.

Execute SQL Task in SSIS Full Row Set 13

Click OK to close the Foreach Loop container. Next, Drag and Drop the Data Flow task inside the Foreach Loop.

Execute SQL Task in SSIS Full Row Set 14

Double click on the Data Flow Task will open the data flow tab. Drag and drop OLE DB Source, Derived Column Transformation, and OLE DB Destination from the toolbox to data flow region

Execute SQL Task in SSIS Full Row Set 15

Double click on OLE DB source, and connect to the SQL Tutorial database from the SQL Server. Next, we selected the SQL Command as the Data access mode, and write a simple command. This command returns RowNumber as Column, and its value is 1.

Execute SQL Task in SSIS Full Row Set 16

SQL Command that we used in the above screenshot is:

SELECT 1 AS RowNumber

Next, Double click or right-click on the Derived Column Transformation to add new columns based on the variables. First, let me add a new column for the FirstName variable.

As you can from the below screenshot, we are using the Type Cast function DT_STR to convert the variable value to a string type of length 50.

Execute SQL Task in SSIS Full Row Set 17

Please add the new columns for the remaining variables, as well.

Execute SQL Task in SSIS Full Row Set 18

Next, Double click on the OLE DB Destination to save these newly created columns into the SQL Server database.

Execute SQL Task in SSIS Full Row Set 19

For now, we are connecting to the SQL Tutorial database. I forgot to create a table in the SQL Server so, let me click the New button so that the OLE DB Destination editor will automatically create a table for me.

Execute SQL Task in SSIS Full Row Set 20

It is the table that was generated by the Ole DB. Remember, we removed the unwanted RowNumber column from this definition.

Execute SQL Task in SSIS Full Row Set 21

Click on the Mappings tab to check whether the source columns exactly mapped to the destination columns.

Execute SQL Task in SSIS Full Row Set 22

Clicking OK to finish configuring Execute SQL Task in SSIS Full Row Set package. Let us run the package and see whether we transferred the data using Execute SQL Task or not

Execute SQL Task in SSIS Full Row Set 23

Let us open the SQL Server Management Studio Query window to Preview the data.

Execute SQL Task in SSIS Full Row Set 24

Placed Under: SSIS

  • What is SSIS
  • Install SQL Server Data Tools
  • Learn SSIS in 28 Days
  • Create a SSIS Project
  • Create SSIS Package
  • SSIS Connection Manager
  • OLE DB Connection Manager
  • SSIS ADO Connection Manager
  • ADO.NET Connection Manager
  • SSIS Cache Connection Manager
  • SSIS Excel Connection Manager
  • SSIS File Connection Manager
  • SSIS FTP Connection Manager
  • SSIS SMO Connection Manager
  • Source Assistance in SSIS
  • Flat File Source in SSIS
  • OLE DB Source in SSIS
  • Excel Source in SSIS
  • ADO.NET Source in SSIS
  • SSIS FLAT FILE Destination
  • SSIS OLE DB Destination
  • SSIS ADO.NET Destination
  • SSIS Transformations
  • SSIS Audit Transformation
  • SSIS Aggregate Transformation
  • SSIS Aggregate Advanced Mode
  • SSIS Cache Transformation
  • SSIS Character Map
  • SSIS Conditional Split
  • SSIS Copy Column
  • SSIS Data Conversion
  • SSIS Derived Column
  • SSIS Export Column
  • SSIS Fuzzy Grouping
  • SSIS Fuzzy Lookup
  • SSIS Import Column
  • SSIS Lookup Introduction
  • Lookup – OLE DB Connection
  • SSIS Lookup in Full Cache Mode
  • SSIS Lookup – Case Sensitivity
  • SSIS Merge Transformation
  • SSIS Merge Join Transformation
  • SSIS Merge Join – Left Outer Join
  • SSIS Merge – Right Outer Join
  • SSIS Merge Join – Full Outer Join
  • SSIS Multicast Transformation
  • SSIS OLEDB Command
  • OLEDB Command – Delete Data
  • OLEDB Command-Update Data
  • SSIS Percentage Sampling
  • SSIS Pivot Transformation 2008
  • SSIS Pivot Transformation
  • SSIS Row Count Transformation
  • SSIS Row Sampling
  • Script Component as Source
  • Script Component as Destination
  • SSIS Script as Transformation
  • SSIS Sort Transformation
  • SSIS SCD Type 0
  • SSIS SCD Type 1
  • SSIS SCD Type 2
  • SSIS Term Lookup
  • SSIS Term Extraction Intro
  • Term Extraction – Extract Nouns
  • SSIS Extract Noun Phrases
  • Extract Nouns & Noun Phrases
  • Term Extraction – Exclusion Tab
  • SSIS Unpivot Transformation
  • SSIS Union All Transformation
  • SSIS For Loop Container
  • SSIS ForEach File Enumerator
  • SSIS ForEach SMO Enumerator
  • SSIS ForEach Variable
  • SSIS Foreach NodeList
  • Foreach ADO.NET Schema Rowset Enumerator
  • SSIS Bulk Insert Task
  • SSIS Data Profiling Task
  • Execute T-SQL Statement Task
  • SSIS Execute SQL Task Intro
  • SSIS Execute SQL Task Example
  • Execute SQL Task- Single Rowset
  • Execute SQL Task – Full Row Set
  • SSIS Execute Package Task
  • Execute Packages in SQL Server
  • Execute Packages in File System
  • SSIS Execute Package Project Reference
  • SSIS File System Task
  • SSIS File System Task- Copy Files
  • File System Task-Copy Directory
  • File System Task – Delete Files
  • File System Task – Delete Folder
  • File System Task -Move Directory
  • SSIS File System Task -Move File
  • File System – Move Multiple files
  • File System Task – Rename File
  • File System Task – Set Attributes
  • SSIS FTP TASK
  • SSIS Create Local Directory
  • SSIS Create Remote Directory
  • SSIS FTP Task Send Files
  • SSIS FTP – Send Multiple Files
  • SSIS FTP Task Delete Local Files
  • FTP TASK Delete Local Directory
  • FTP Task Delete Remote files
  • SSIS Delete Remote Directory
  • SSIS FTP Task Receive Files
  • SSIS FTP Receive Multiple Files
  • SSIS Script Task
  • Transfer SQL Server Objects Task
  • Transfer SQL Table Structures
  • Transfer SQL Tables with Data
  • Transfer SQL Stored Procedures
  • Transfer User Defined Functions
  • Transfer SQL Views in SSIS
  • SSIS Web Service Task
  • SSIS XML Task-Validate XML File
  • Transform XML File using XSLT
  • XML Task-XML files Differences
  • Create SSIS Catalog
  • Package Deployment using BIDS
  • Deploy Package Using SQL
  • Deploy using SQL Server Wizard
  • SSIS Breakpoints
  • SSIS Checkpoints
  • SSIS Error Handling
  • SSIS Event Handlers
  • SSIS Transactions
  • SSIS Logging
  • SSIS Parameters
  • SSIS Package Configuration
  • Configure using SQL Server
  • Config using Registry Entry
  • Conf with Environment Variable
  • SSIS XML Configuration File
  • XML Configuration File Part 2
  • SSIS Package Protection Level
  • SSIS Incremental Load
  • Incremental Load Example 2
  • SSIS Remove Double Quotes

Copyright © 2021 · All Rights Reserved by Suresh

About Us | Contact Us | Privacy Policy