How To Import Excel Data Into SQL Table Using SQL Server Database

Hello Friends, In this article I will explain how to import excel data into SQL table using SQL Server Management Studio (SSMS). Microsoft added lots of new features in SQL Server Management Studio(SSMS) to make it a more helpful tool. One more features “Import Flat File…” option has been added by Microsoft in SSMS 17.3. By using this graphical user interface (GUI) feature we can import flat-files data into SQL Server. These features are more powerful as compared to the “Import Data From flat-file” option. You can download the latest version of SQL Server Management Studio(SSMS) by click here.

For using this feature, you just have to right-click on the database in which you want to import data using a flat file. Then go to Tasks and then click on the “Import Flat File…” option as shown below.

Step 1:- First you open excel and add demy data if you want. Here I am adding employee Information in excel data.

Step 2:- After adding employee information  in excel to save this file with .CSV Extension.

Step 3:- Open SQL Server Management Studio (SSMS) and select database name which the database you want to store employee details. I am selected “EmpDB” Database.

Step 4:-  For using this feature, you just have to right-click on the database in which you want to import data using a flat-file. Then go to Tasks and then click on the “Import Flat File…” option as shown below.

Step 5:-  This will open up Import Flat File wizard. Here the first page is Introduction Page where we can get some introductory details about this feature. If you don’t want to see this page next time then just check the Do not show this page again. Now click the Next button to proceed.

Step 6:-  After clicking on the Next button, you will get a specific input file page. Here you can specify the input file by using the browse button. By default, the table name will be the same as the file name. if you want, you can change the table name here. Finally, you can also specify the schema name, under which a new table will be created for the imported data.

Step 7:- After specifying this entire information, click on the next button. Then you will get a preview page under this “Import Flat File…” wizard.

Step 8:- After clicking on the Next button, you will get Modify the Column page. Here you can change any column name or data type of column, specify the primary key and allow nulls setting.

Step 9:- After making all required changes then clicking on the Next button. Now you will be on Summary Page.

Step 10:- After completion, you will see the result as Success or Failure.

Step 11:- Now clicking  on the close. Now you can check the imported data in SQL Server using T-SQL select statement. After refresh database you can see “EmployeeDetails” table.

Step 12:- Check your imported excel data properly inserted or not in “EmployeeDetails” table.

Please give your valuable feedback and if you have any questions or issues about this article, please let me know.

Also Check  What Is Temporary Tables In SQL

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories