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 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-04-20 : 02:51:13
|
| Im getting this error to send query result to email.How to solve?Error:Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 495Query execution failed: ?Msg 208, Level 16, State 1, Server testing, Line 1Invalid object name '#Table1'.IF OBJECT_ID('tempdb..#Table1') IS NOT NULL drop table #Table1select distinct FirstName,Lastnameinto #Table1from #Table2BEGINEXEC msdb.dbo.sp_send_dbmail @recipients='test@yahoo.com', @body='test', @subject ='test', @profile_name ='testing', @query ='select * from #Table1', @attach_query_result_as_file = 1 ;END |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-20 : 14:56:30
|
| why do you need temporary table? why cant you pass query directly to sp_send_dbmail?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|