Skip to main content

Development

How to Import Data from Excel in Microsoft SQL SERVER

There may be cases where the data source can be in a specific format to insert into the database. If an enormous amount of data is present in other sources such as a flat file or excel, SQL Server allows the user to import data from it using the Import Data Wizard. Here’s how:

  1. Right click on the corresponding database in which the data is to be inserted and navigate to Tasks -> Import Data

Import Data

  1. Click on Import Data to open up the wizard and click Next to select the source. In this case, a spreadsheet is used as an input source, so Microsoft Excel has to be selected

select source3. Choose the file by clicking on the browse button and the path will be automatically populated. Select the excel version. If the first row of the spreadsheet contains names, check “First row has column names”.

4. Choose the Destination. In this case, it is being imported into SQL Server. Choose the server name for the drop down list and specify the authentication type. Select the database where the data needs to be inserted.

choose desti

5. Select how you would like it copied. You can either copy the entire spreadsheet or a query can be written in order to restrict data from the source. Click the next button to continue.

choose type

6. Choose the destination table in which the data has to be inserted. Ensure the correct column mapping has been done to perform the insertion of data into the appropriate fields by clicking on the Edit Mapping button.

mapping

7. To complete the wizard, click on the Finish button to display the status of the task. The status of the tasks can be viewed using the Report menu and the statuses can be saved as a file for future reference.

status_result

8. Data is added into the table.

db result

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Prabakar Murali

More from this Author

Categories
Follow Us