Solved

Can I export SQL table output to excel?

Posted on 2011-03-18
5
588 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
Comment Utility

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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now