September 26, 2008 at 4:19 pm
Just curious, is it possible to get sql output directly onto a excel file using SSMS. I need it in a presentable format. Please share your inputs.
Thanks.
M&M
September 26, 2008 at 5:23 pm
You could use OPENROWSET in your T-SQL statement which would write your output to an Excel workbook
An example is:
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\MSSQL\Test.xls', 'SELECT * FROM [Sheet1$]')
SELECT * FROM Keywords
check BOL for examples
An excellent article with sample code and a good explanation is:
http://www.simple-talk.com/sql/t-sql-programming/sql-server-excel-workbench/
Hope this helps.
September 26, 2008 at 5:38 pm
Oh. Thank you. I didn't know I will get an answer so quickly.
Thank you very much.
M&M
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply