Solved

Can I export SQL table output to excel?

Posted on 2011-03-18
5
589 Views
Last Modified: 2012-05-11
I have some SQL query's that output the data in table format when executed.  I am just wondering if there is a way to automatically pull the data from the table to an excel file.  Or more specifically, pull parts of the data to specific parts of an excel file.  Like say pull the data from the second column of the query ouput and place it in excel Column C (below current data if possible).  Or even match up dates (which are part of the SQL output) to the dates in column A of the excel file.

I have a feeling this isn't possible or is way more work then its worth, but I wanted to check and see.  I know I can highlight and copy data over, but I'm hoping for more automation.  Thanks for the help.
0
Comment
Question by:mjburgard
5 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 250 total points
ID: 35169328

I doubt you could save it to excel in any simplistic manner, you would have to use the export data function.

Saving to a text file on the other hand is very simple, you could even save to a .csv file which you can open using excel.

Just go to the menu
Query->Results To

You have to options
1. Results To Text
2. Results To File
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 35169425
Can can always initiate the data connection from inside of excel, but it would take some fairly crafty VBA coding to do what you want to do.
0
 
LVL 3

Assisted Solution

by:a_hassaan
a_hassaan earned 250 total points
ID: 35169461
use "ETL" of microsoft Integration Services Project
it's very very easy... a flow chart drag and drop builder.
I can help you with that if you want.
and then you can export to excel, schedule your task, read from excel, or even send results by mail.

it's ETL = "Export Tranform & Load"
0
 
LVL 8

Expert Comment

by:Som Tripathi
ID: 35171725
You can directly Export table to Excel using T-SQL.

Please find the same script at -
http://mssqlserver.1talk.net/t53-export-sql-server-table-to-excel#60
0
 
LVL 1

Author Closing Comment

by:mjburgard
ID: 35193928
So its seeming like that I was correct in saying there is no easy way to do this.  Thanks for the other ideas, I'll look into them.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question