.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> DataBase >> Post New Resource Bookmark and Share   

 Subscribe to Articles

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

Posted By:Karthikeyan Anbarasan       Posted Date: March 22, 2011    Points: 200    Category: DataBase    URL: http://www.dotnetspark.com  

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
 

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.

To follow my series of articles on SSIS packages refer to the below URL's

Basics of SSIS and Creating Package - SQL Server Integration Services (SSIS) - Part 1

Transforming SQL Data to Excel Sheet - SQL Server Integration Services (SSIS) - Part 2

Export Data using Wizard - SQL Server Integration Services (SSIS) - Part 3

Import Data using Wizard - SQL Server Integration Services (SSIS) - Part 4

Building and Executing a Package - SQL Server Integration Services (SSIS) - Part 5

Options to execute a package in SSIS - SQL Server Integration Services (SSIS) - Part 6 

Options to Deploy a package in SSIS - SQL Server Integration Services (SSIS) - Part 7

Scripting in SSIS Packages - SQL Server Integration Services (SSIS) - Part 8

Breakpoints in SSIS Packages - SQL Server Integration Services (SSIS) - Part 9

Check Points in SSIS Packages - SQL Server Integration Services (SSIS) - Part 10

Send Mail in SSIS Packages - SQL Server Integration Services (SSIS) - Part 11

For Loop task in SSIS Packages - SQL Server Integration Services (SSIS) - Part 12

Backup Database task in SSIS and Send Mail - SQL Server Integration Services (SSIS) - Part 13

Folder Structure in SSIS - SQL Server Integration Services (SSIS) - Part 14 

Conditional Split Task in SSIS - SQL Server Integration Services (SSIS) - Part 15

Sequential Container Task in SSIS - SQL Server Integration Services (SSIS) - Part 16

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.


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


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


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


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.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend