In this post we will import an excel file into SQL Server database using SSMS tool. SQL server allows you to import different data sources such as flat files CSV, excel file etc. Use the following steps to import an Excel file into SQL Server.
- Open the SSMS.
- Login to SQL Server.
- Press F8 to view Object Explorer window.
- Select the database in which excel file to be imported.
- Right click the database.
- Click Tasks menu item and then click Import Data menu item.
- SQL Server Import and Export Wizard dialogue box appears. Click the Next button.
- Select the correct data source from the drop down. To import excel file we use Microsoft Excel from the dropdown. Select the Excel version and then Click the Browse button to pick the Excel data file. Click the Next button.
- Now we choose the destination in the Destination textbox. We select SQL Server Native client in the server name. Use Windows authentication or SQL server authentication and click the Next button.
- Select first radio button 'Copy data from one table or view'. Click Next button.
- Click Edit Mapping to correct the data types of table, if required. You can leave it otherwise. Click Next button twice and finally click Finish button. The table will be generated in the selected database. Click the Close button.
- Refresh the selected database. You get the table into the Tables folder. Excel generated table name is suffixed with dollar symbol. You can rename this table to remove dollar symbol.
Based on the excel file, table will be created in the database.
In the next post we will learn about how to Generate Insert Query from table SQL Server.
No comments:
Post a Comment