February 4, 2004 at 5:00 am
does anybody know how to convert results from t-sql to excel ??
thanks
February 4, 2004 at 5:04 am
If you use QA, try Extras-> Options -> Results Tab. There you can specify, that you want a csv file as result that Excel can read.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
February 9, 2004 at 9:11 am
If you're running the t-sql interactively in Query Manager you can also : view results in grid, then select the grid in the results pane, right-click in top corner of the grid and select copy then paste into Excel.
February 9, 2004 at 12:31 pm
You might also look at using OPENDATSOURCE and simply inserting the data directly into an XLS file.
To retrieve data...
---------------------------------------------------------------------------------------------------------------------------------
-- TODO: Make sure to change the name/path of the spreadsheet below to reflect your machine.
-- Also: Make sure the cells and Sheet name are the same as the select statement.
-- Make sure the worksheet is shared out from within Excel. "Tools/Share Workbook..."
---------------------------------------------------------------------------------------------------------------------------------
INSERT INTO #TempTable(<FieldList>
SELECT <FieldList>
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0'
,'Data Source="<FilePath>.xls";User ID=Admin;Password=;Extended properties=Excel 8.0'
)...Sheet1$
-- To Insert Data
INSERT INTO OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0'
,'Data Source="<FilePath>.xls";User ID=Admin;Password=;Extended properties=Excel 8.0'
)...Sheet1$(<FieldList>
SELECT <FieldList>
FROM Foo
Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer
This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.
February 9, 2004 at 11:00 pm
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply