November 18, 2003 at 10:54 am
Is there a way to output the results of a query using SQL mail directly to an Excel Spreadsheet and if so, how ?
Thanks
November 18, 2003 at 1:13 pm
No direct way, but you can setup a DTS pack to generate a .xls file by specifying the same query and let sqlmail pick the file and email.
EXEC master..xp_sendmail
@recipients = 's2v'
,@message = ' Pls find the Execel sheet'
,@subject = 'Execl Attached'
,@attachments = 'c:\test.xls'
The path is from the server.
Shas3
November 19, 2003 at 5:03 am
You could save the file as comma-delimited and a .csv extension. Most pc's have excel assigned as the default application to open comma seperated files.
November 19, 2003 at 8:32 am
I have a procedure to BCP from a view and export the data into a spreadsheet. Works like a charm.
EXECUTE master..xp_cmdshell 'BCP Database..ViewName out "E:\FullPath\Spreadsheet.xls" /c /Sserver /Uuser /Ppassword'
Linda
November 19, 2003 at 10:52 am
As Linda said, BCP is also another option in place of DTS
Shas3
November 20, 2003 at 2:31 am
if you have same query then you can use OSql utility
Osql -o option can be used for get the query resulet in .xls file.
and u can create a .Bat file to execute this command put the schedule thru OS.
for more detail see BOL.
Manoj Kumar
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply