我正在尝试通过数据库邮件发送文件,当我在没有@query 选项的情况下执行下面的查询时,邮件被触发,但是当我包含@query 选项时,我得到了提到的错误。
if @@rowcount >0
EXEC msdb.dbo.sp_send_dbmail @profile_name = ' Errormail',@recipients='arunkumarb@mobiusservices.in;',
@subject = 'A new Record created in the SSORunError Log Table' ,
@body = 'A new Record created in the SSORunError Log Table' ,
@query = 'select * from ip',
@attach_query_result_as_file = 1,
@query_result_width = 4000,
@query_attachment_filename = 'Details.txt'
错误信息 :
Msg 22050, Level 16, State 1, Line 0
Error formatting query, probably invalid parameters
Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 504
Query execution failed: Msg 208, Level 16, State 1, Server , Line 1
Invalid object name 'ip'.
提前致谢