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 |
|
gsavitha
Starting Member
3 Posts |
Posted - 2011-01-31 : 11:11:21
|
| Hi All,I need to send the query result in mail.I Succeffuly configured the database mail setup and received the test mail.But If i execute the below query :-EXEC msdb.dbo.sp_send_dbmail@recipients=sg@domainname.com',@body='Message Body', @subject ='Message Subject',@profile_name ='test',@query ='select top 10 * from cst ', @attach_query_result_as_file = 1,@query_attachment_filename ='Results.txt'I got this error:-Msg 22050, Level 16, State 1, Line 0Error formatting query, probably invalid parametersMsg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 504Query execution failed: ?Msg 208, Level 16, State 1, Server REPORT-PC, Line 1Invalid object name 'cst'.I any idea wold be very helful.Thanks in advance.. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-31 : 11:30:56
|
Maybe it is helping to specify the tablename in this form:databasename.dbo.cstSo it would look like,@query ='select top 10 * from databasename.dbo.cst 'where databasename should be replaced by your correct databasename. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|