Currently, I am working on a project that requires data tranfer from excel files to sql server database. In this article, i will show you how to transfer data from one source to another. Follow the these steps.
-
Launch Business Intelligence Development Studio by selecting All Programs Microsoft SQL Server 2005/2008 SQL Server Business Intelligence Development Studio from the Start menu.
-
Select File New Project... from the main menu to open the New Project dialog.
-
Press the OK button to create the new project and dismiss the New Project dialog. A designer for the new package is created in Business Intelligence Development Studio
-
Select the Control Flow designer.
-
Open the Toolbox by selecting View Toolbox from the main menu.
-
Drag a Data Flow Task from the Toolbox onto the Control Flow designer. The Data Flow Task moves data from source to destination providing facilities for transforming the data as it is moved.
-
Select the Data Flow designer tab
-
Drag a Excel Source from the Toolbox onto the Data Flow designer.
-
Configure the Excel Source by right-clicking it and selecting Edit... from the context menu
-
It will open the Excel Source Editor, then in connection manager, click on New to create a new connection.
-
For Excel connection string, select a desire file that you would like to import, then select your excel file version.
-
First row has a column name is already checked, make sure in your excel sheet First row has a column name, otherwise unselect the checkbox and click OK.
-
Now in Data Access Mode, You can either select Table or View or SQL Command. If your sheet is simple then you can go with Table or View.
-
Next select a name of the excel sheet e.g default name will be sheet1$ and you can see the preview to make sure your sheet is being read.
-
Click on a columns, and then select the desired columns and click OK.
-
Now drag a SQL Server destination from the Toolbox onto the Data Flow designer.
-
Select the Excel Source . The component output and output error flow paths (green and red arrows extending downward) appear. Drag the output path to the SQL Server Destination. A green arrow now connects the Excel Source to SQL Server Destination indicating the flow of data between the components.
-
Configure the SQL Server destination by right-clicking it and selecting Edit... from the context menu and repeat step 10 to 14 for connection string.
-
Click on a mapping, and then select the desired input columns and map them to destination columns and click OK.
-
Now You are ready to execute the package, which will read all of the data from the Excel File, and write it to a SQL server database.
-
Select the Data Flow designer. Select Debug Start Debugging from the main menu to execute the package. Once package execution has completed.
-
Finally, Select Debug Stop Debugging from the main menu.
The process of inputting and outputting data is similar whether the source is a flat file, a database, or some other source.