Using the SQL Server Import and Export Wizard to Export To Excel

Using the SQL Server Import and Export Wizard to Export To Excel


In this video I’m going to walk through
the steps for exporting a query from SQL Server
Management Studio to Microsoft Excel. I have started by creating the query that I want to
export. So I’m going to use the AdventureWorksLT2012 database. I’ve written my query. I’m going
to run it to make sure it returns the results that I desire. And now I’m going to start the export
process. I’m going to begin by right-clicking on
the database that I’ve used to create my SELECT
statement. So right-click, go to Tasks. Down towards
the bottom of this list I see Export Data. This takes me to the first step in the SQL Server Import and Export
Wizard. I’m going to click Next. I’m going to
leave the Data source as the SQL Server Native Client.
And I’m using SQL Server 12. The native client for 12 is 11.0. The server–this is the name that the
server on which I’m working. This is the name of the database that
I’m using. I’ll click Next At the destination I’m going to specify that I want to
use Excel. Then I’m going to click Browse and I’m going to you create a file on the desktop. You can see that
have already created one called Export test 1. I’m just going to call this Export test
2. And I’ll click Open, and I should see the name of the file that I’m going to create along
with the path. The Excel version is 97 – 2003 and I do have column headers in my first
row. I’ll click Next. I’m not going to copy the
data from one or more tables or views. I’m going to write a query to specify the data to transfer. That
query has been written here. I’ll select that and go back to my wizard. Click Next and paste in my select
statement. I’ll click parse to see if my statement
will . It is saying say now that it can’t be parsed,
and part of that problem is that I left the select clause off. So I’ll just try this again. And see if I
can get the whole statement this time. That looks a little better and I’ll try
parsing it again. It’s telling me that my statement is valid, which means that the syntax works. But it
doesn’t necessarily mean the export will take place correctly. I’ll click Next. And I can look at my mappings. Here’s my source, my destination, it’s a long integer, its short integer, currency, decimal, and that looks okay. And I can do a preview of my data. And that matches the data set that I
received when I ran the query in SQL Server. Click OK. I’ll click Next. I’m going to run immediately and click
Next. And this just tells me information about my export. And I’ll go ahead can click Finish. It runs correctly. I’ll close this. And now I’m going to find the file that I created on my desktop. I’ll open it in Excel. I’ll take the four columns here, resize them to fit, save and when I submit my homework I’m going to attach this file.

Leave a Reply

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