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
 SQL Server Development (2000)
 Sending an email with a result set

Author  Topic 

lightningtomo
Starting Member

4 Posts

Posted - 2002-06-24 : 06:23:43
I cannot use SQL Mail, so I have to use a component (either JMail or ASP Mail). However, I really need to send the results of a stored procedure to someone every day in this email, so the functionality in SQL Mail to send a result set would be great. Can I do this with a 3rd party component , and if so, HOW?

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-06-24 : 08:04:43
I'd guess you'd need to create a temp file and attach it then delete the file. You could use bcp or osql to output a file from a query.

[url]http://www.sqldev.net/xp/xpsmtp.htm[/url] this is an xp that uses SMTP however it does not yet allow sending of queryresults like xp_sendmail but I would expect it to in the near future - its in the to do list

HTH
Jasper Smith

Go to Top of Page

lightningtomo
Starting Member

4 Posts

Posted - 2002-06-24 : 08:22:14
Thanks Jasper. Unfortunately this is for management - opening attachments = too difficult!

Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-06-24 : 09:56:47
you can use sp_makewebtask to generate an HTML page and then put that in the body of your email (or point to the file). If you want the message in the body then you should be able to use xpsmtp as this allows HTML bodies, you could construct the message dynamically in SQL based on query and wrap it in some HTML tags

HTH
Jasper Smith

Go to Top of Page

lightningtomo
Starting Member

4 Posts

Posted - 2002-06-24 : 11:30:07
Genius! Works a treat, ta very much.

Go to Top of Page
   

- Advertisement -