Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 xp_sendmail

Author  Topic 

marat
Yak Posting Veteran

85 Posts

Posted - 2004-12-22 : 00:07:09
Is it possible to send results of the query in csv format?
I was using
EXEC xp_sendmail @recipients = 'robertk',
@query = 'SELECT * FROM INFORMATION_SCHEMA.TABLES',
@subject = 'SQL Server Report',
@message = 'The contents of INFORMATION_SCHEMA.TABLES:',
@attach_results = 'TRUE', @width = 250

and result file wasn't readable.

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-22 : 08:53:10
I take it you want the recipient to default to opening the attachment in excel?
Use bcp or osql to create a .csv file then attach that to the email.

You might also want to have a look at this if you are doing a lot of emailing.
http://www.nigelrivett.net/Email.html


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

marat
Yak Posting Veteran

85 Posts

Posted - 2004-12-22 : 18:17:01
Thanks Nigel
Go to Top of Page
   

- Advertisement -