Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending stored procedure results via Email in Sql Server 2005

Posted on 2008-06-20
2
Medium Priority
?
496 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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

704 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