Floating FB popout byF5debug

SQL Server Integration Services (SSIS) – Part 17 – Create/Delete a table in SQL using SSIS

 

This is part 17 of the series of article on SSIS and shows how to create/delete a table in SQL using SSIS.

Introduction

In this article we are going to see on how to run a query from SSIS. Mainly create or delete a table from SSIS package. We have a task called Execute SQL Task in SSIS which helps us to do this task. Let’s see on how to use this task and create a table using SSIS. This task will be mainly used in scenario like if at all we need to check if table exists or not and to create a table using this task.

You can look into my series of article on SSIS at the url - http://f5debug.net/tutorial/ssis.aspx

[more]

Steps

Follow steps 1 to 3 on my first article to open the BIDS project and select the right project to work on integration services project. Once the project is created, we will see on how to use Execute SQL task and create a table using the same.

clip_image001

I just dragged and dropped the execute SQL task as shown in the above image. Double click on it will open the configurations tab as shown below

clip_image002

Here we need to configure the connection and the SQLStatement. Here the statement we are going to execute is a create table statement as shown in the below code

CREATE TABLE [dbo].[EmployeeTable]([EmpID] [int] NOT NULL, [EmployeeName] [nvarchar](100) NULL, [EmpDesignation] [nvarchar](100) NULL, [EmpAge] [int] NULL,) ON

[PRIMARY] GO

Now we are confirmed that the configuration is done and ready to run the package

Press F5 will build and execute the package as shown in the below screen

clip_image003

The output of the package is the creating of table Employeetable in Northwind Database. Just go to the SSMS and query the table Select * from Employeetable we will see the table with no recrods as shown below

clip_image004

Similar way we can create an Execute SQL task in order to delete the table with the same structure.

Conclusion

So in this article we have seen on how to use the Execute Sql task container to Create or Delete a table from SSIS packaging.

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter