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 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 REPORT-PC, Line 1
Invalid object name 'cst'.
Any idea would be very helful.Thanks in advance..
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 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 REPORT-PC, Line 1
Invalid object name 'cst'.
Any idea would be very helful.Thanks in advance..