Showing posts with label Microsoft SQL Server 2016 Developer. Show all posts
Showing posts with label Microsoft SQL Server 2016 Developer. Show all posts

Tuesday, May 8, 2018

How to get data from SQL Server into MS Excel? - Part 1

Microsoft EXCEL and Microsoft SQL Server are highly compatible. You could get data from SQL Server into MS EXCEL and vice-versa very easily.

Make sure you have access rights to what you are getting from SQL Server and that the Database engine has started.

For this post I will be getting data from the Northwind database on my SQL Server shown here:


ExcelFromSQLServer_0

Launch your EXCEL application. What I have is EXCEL(x32bit) from Office 365 subscription.
Click Data and Get Data. Review the options in the menu and click From SQL Server Database as shown.


ExcelFromSQLServer_1

The following window opens where you are expected to enter the SQL Server Database information.


ExcelfromSQLServer_2.png

Enter the SQL Server Database Engine info in the form of <computername\Server-instance_name>, you can get a hint from the SQL Server Management Studio in the first image above. The database (name) is optional. The Advanced options provides a means for issuing a SQL statement, such as query as shown.

ExcelfromSQLServer_3.png

We will provide neither a database name nor use the Advanced Options.

Click OK.

The Navigator window opens as shown.

ExcelfromSQLServer_4.png

Click Northwind to display all the tables and views in the database.

ExcelfromSQLServer_5.png

Now you have access to all the database objects.

In Part 2 we will look at developing queries etc.