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.
Author |
Topic |
joe8079
Posting Yak Master
127 Posts |
Posted - 2013-10-30 : 09:20:07
|
Hi, is it possible to embed a result set from a table into the msdb.dbo.sp_send_dbmail stored procedure when an email is sent out: Below i'm creating a test temp table of 10 rows that I need to embed in the msdb.dbo.sp_send_dbmail. I need to embed the whole table which is about ten rows into that stored procuedureSample Data: Creates a test table of 10 rowsUSE tempdb CREATE TABLE #ValueTable ( [value] INT ) INSERT INTO #ValueTableVALUES ( 1 ), ( 2 ) INSERT INTO #ValueTableVALUES ( 3 ), ( 4 ) INSERT INTO #ValueTableVALUES ( 5 ), ( 6 ) INSERT INTO #ValueTableVALUES ( 7 ), ( 8 ) INSERT INTO #ValueTableVALUES ( 9 ), ( 10 ) --Need to excecute this stored procedure and embed the temp table created above. Is this possible and if so how would I go about doing that?EXEC msdb.dbo.sp_send_dbmail @profile_name = 'profileName', @from_address = 'fromAddress', @recipients = 'Joe', @subject = 'data', @sensitivity = 'Personal', @importance = 'High', @body_format = 'HTML', @body = 'need to insert table of values from temp table #valueTable' DROP TABLE #ValueTable |
|
joe8079
Posting Yak Master
127 Posts |
Posted - 2013-10-30 : 09:59:18
|
I actually figured this out using this link: http://www.mssqltips.com/sqlservertip/2347/send-email-in-a-tabular-format-using-sql-server-database-mail/ |
 |
|
|
|
|
|
|