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 |
|
tejicen
Starting Member
17 Posts |
Posted - 2009-07-15 : 04:32:40
|
| Hi,Iam using a temp table in sp_send_dbmail.But when I execute the statement it tell's me.message: Incorrect syntax near '@tmpTBL'.Can anyone tell me what i have done wrong!!declare @inVarde nvarchar(max)set @inVarde = 'One more week then vacation!'declare @tmpTBL table(varde nvarchar(max))insert into @tmpTBLselect varde = @inVarde--select * from @tmpTBLexec msdb.dbo.sp_send_dbmail@profile_name = 'info',@recipients = 'info@mobill.se',@importance ='High',@query = 'select * from master.dbo.@tmpTBL',@subject = 'TEST!',@query_attachment_filename ='Results.txt'regards, tejicen |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-15 : 08:27:21
|
| declare @inVarde nvarchar(max)set @inVarde = 'One more week then vacation!'declare @tmpTBL table(varde nvarchar(max))insert into @tmpTBLselect @inVarde--select * from @tmpTBLexec msdb.dbo.sp_send_dbmail@profile_name = 'info',@recipients = 'info@mobill.se',@importance ='High',@query = 'select * from master.dbo.@tmpTBL',@subject = 'TEST!',@query_attachment_filename ='Results.txt'-------------------------R.. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-15 : 13:00:29
|
| why put the message first in a table and then use it in query to mail? cant you directly give message as parameter value to sp_send_dbmail? |
 |
|
|
|
|
|