February 5, 2009 at 6:20 pm
Dear All,
How can i output query result to a specific cell in a preformatted excel file. Thanks.
February 6, 2009 at 6:44 am
Sounds like something you should be doing within Excel with VBA, so an Excel site may be a better place to ask the question.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
February 6, 2009 at 6:55 am
Jack Corbett (2/6/2009)
Sounds like something you should be doing within Excel with VBA, so an Excel site may be a better place to ask the question.
Actually Im not. Maybe my question is not specific enough. Sorry for my english. I would like to rephrase my question.. How can I output my SQL Query to an excel file or in a specific cell of an excel file.. thanks for the reply
February 6, 2009 at 7:01 am
What are you using to generate the results (SSMS, Reporting Services, A custom application)?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
February 6, 2009 at 7:11 am
Im a newbie to T-SQL and a little programming knowledge. What can you suggest? Do you have a sample script just to give me an idea on how to start it?
February 6, 2009 at 7:26 am
Since I don't really know what you need to do and why I can't really make any suggestions. If you have SQL Server other than express edition you have Reporting Services included and this is a GUI report writer that will allow you to export results to Excel, so it may be the best option.
Or you can use VBA in Excel to connect to SQL Server and return the results to Excel, but, as I mentioned, that is really a question for Excel gurus not SQL gurus.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
February 6, 2009 at 11:58 am
TomYum - Openrowset is a quick method to export to Excel but please note the requirements carefully
/*This is an example of how to output to Excel.
Requirements:
This willl not work with Excel 2007, but will with earlier versions of Excel
Spread sheet must exist on the SERVER
In row 1 must be the names of the table fields being exported
Database=F:\TestData\Book2.xls' - is the full path and name of the existing Excel work book
FROM [Sheet1$]') designates which sheet of the work book will be utilized. (The $ sign is required)
SELECT * FROM your tables name - in the example it is "Keywords"
*/
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=F:\TestData\Book2.xls',
'SELECT * FROM [Sheet1$]')
SELECT * FROM Keywords
February 6, 2009 at 6:03 pm
Jack Corbett (2/6/2009)
Since I don't really know what you need to do and why I can't really make any suggestions. If you have SQL Server other than express edition you have Reporting Services included and this is a GUI report writer that will allow you to export results to Excel, so it may be the best option.Or you can use VBA in Excel to connect to SQL Server and return the results to Excel, but, as I mentioned, that is really a question for Excel gurus not SQL gurus.
Thank you Jack...
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply