The previous post was about importing Excel to SQL Server. This post will guide you to do the reverse, SQL Server tables to Microsoft Excel. The slideshow below would guide you through the steps involved in importing SQL Server table to MS Excel 2007 and higher versions.
The steps involved are
- Open a fresh sheet in excel
- Go to the data tab in the ribbon
- Select “From SQL” in the “From Other Sources” menu
- A Wizard will open. Follow the steps shown in the above slide show for selecting the SQL Server database and table and click finish
- This will import the desired table to your excel sheet.
In the same way, we can also import the other data sources to Microsoft Excel. Hope it helps. Happy learning!!
The Screenshots below guides you through importing your MS Excel file into your SQL Server Database.
The Steps involved are
- Connect with your SQL Instance
- Create a new database to store the excel tables
- Right-click the DB and Select Tasks >> Import Data
- Import Wizard will Open
- Select MS Excel as the Data Source
- Select the excel file path and the version
- Select the database in which excel has to be exported
- Select the radio “Copy data from one or more tables or views”
- Select the tables to be imported
- Complete the wizard and click finish
Will share how to import data from SQL database to MS Excel in the next post. Happy Learning!!!
“An Item with the same key has already been added” is quite a common exception while working with Dictionary object in C#. It arises when you attempt to add a same key to the dictionary object that has a same key. In those cases, you can either update the value corresponding to the key. This can be done as given in the below screenshot.
If you do not want to update your existing Key-Value pairs, you can create a new instance to the Dictionary object and proceed with adding the Key-value pair of your choice. This will also prevent the exception.Please find the screenshot below for more details.
Happy coding folks!