Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting from SQL to Excel

Status
Not open for further replies.

hooggie

Technical User
Jul 6, 2001
58
0
0
GB
I am trying to export data to send to a third party in an Excel Spreadsheet. The third party is extremely fussy about how their data arrives it must be in Excel and numbers have to be numbers.

When I try to DTS data to Excel or script data to Excel using

insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=c:\Test.xls;',
'SELECT * FROM [Sheet1$]')
select COL1, COL2 from SQLTABLE order by COL1

The number columns are always put into Excel as Text.

I have tried formatting the Excel sheet, specifying that the columns exported are numbers but I can't find anything that works.

Anyone got any ideas on this.
 
Not sure if this i sefficient enough, but what I do in these cases is export to txt then import that txt file into Excel and then during import I chhose the relevant format for each column.

A bit long winded, but if it's once off it's not too bad!

Hope this helps.

Michael
 
Unfortunately the goal of this is to have the file emailed to the third party every night automatically so there can't be any manual intervention. Thanks for the reply anyway
 
Do you use any reporting software like MS Reporting Services or Business Objects? Most reporting front-ends will allow you to schedule e-mailed reports in a variety of formats, such as Excel or PDF.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top