Solved

Sending stored procedure results via Email in Sql Server 2005

Posted on 2008-06-20
2
488 Views
Last Modified: 2010-03-20
Hello,
I can a vendor stored procedure that displays data after it runs. I would like to capture that data and have Database Mail send me those data. I've made some attempts to configure it but had no luck.

here is what I have so far:

stored procedure : dbo.cms_load

sample results :
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.
Warning: Null value is eliminated by an aggregate or other SET operation.

EXEC msdb.dbo.sp_send_dbmail
@recipients=N'ruben.edouard@xxx.com',
@subject ='ARCS Load Finished!',
@profile_name ='2005 DB Mail',
@query ='',
@attach_query_result_as_file = 0

but I don't know how to incorporate the stored procedure results to the above email configuring. Should I place the stored procedure in the @query section?
0
Comment
Question by:redouard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:redouard
ID: 21834652
Please help :)
0
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 125 total points
ID: 21836491
Those messages aren't in the same memory space as the T-SQL itself.  As far as I know you can't capture them in SQL.

If you wrote a .NET application that runs the stored procedure the SqlConnection class has a callback mechanism that traps these errors.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.infomessage.aspx
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
T-sql Date Format 9 67
Find unused columns in a table 12 97
Display field if column exists 7 58
SQl query with join with out having to list all fields in main table. 2 32
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question