Home > SSIS > Simple way to execute T-SQL Statement using SSIS – SQL Server

Simple way to execute T-SQL Statement using SSIS – SQL Server


In the database environment there are lots of stored procedures being created to perform some development task.

In this article I will be showing you how to use Execute T-SQL Statement Task to execute a T-SQL Statement. There are so many task properties to customize this task for our need. For instance, if the T-SQL returns value, it may be single row, rowset, etc… that can be configured using ResultSetType property.

Implementation

Step 1: Create a package and add Execute T-SQL Statement task from tool box

Step 2: Edit the task and create connection to the database instance

Step 3: you write your T-SQL Statement directly in the textbox or by variable or file. See the SqlStatementSourceType property. In this example i have used direct input.

Step 4: Click view T-SQL button to see the code that will be sent to SQL Server for execution

Step 5: click OK now. Though the task does not show the error icon on this task we have not completed our configuration. So, Open the connection from the connection manager and select the database in which you would execute the T-SQL.

Step 6: click OK and execute the package

Advertisements
  1. krismaly
    May 31, 2016 at 6:47 am

    Wow
    Awesome

    I followed all the steps and worked fine.

    I enjoyed reading this article and recommend others.

    Please please please keep writing such articles with examples, I love.

    Thanks for educating the community and appreciate your volunteership.

    Thanks a lot

  2. Attila Schmid
    February 9, 2017 at 10:03 am

    Thank you , it is helpful !

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: