I am having the same issue. were you able to solve this?
"Patrick" wrote:
> good day,
>
> When executing the following code:
> EXEC msdb.dbo.sp_send_dbmail
> @profile_name = 'SQLadmin',
> @recipients = 'sqladmin@NRCan.gc.ca',
> @body = 'The following Databases need your attention: ',
> @query = 'Select * from dbo.##Tbl_CombinedInfo',
> @subject = 'TESTING email feature from SQL 2005',
> @attach_query_result_as_file = 0;
>
> I get the following error:
> Msg 22050, Level 16, State 1, Line 0
> Error formatting query, probably invalid parameters
>
> If i remove the @query variables, then it runs great. Can anyone shead some
> light as to why it's giving an error message that i've got invalid parameters?
>
> Thank you very much.
>> Stay informed about: error message using the sp_send_dbmail