Solved

Can I export SQL table output to excel?

Posted on 2011-03-18
5
594 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

688 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