Hi
When using sp_send_dbmail as follows, I receive an email:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Mail',
@recipients = 'some.one@somewhere.com',
@body = 'Customer Cleansing Status BODY',
@subject = 'Customer Cleansing Status'
However, when using sp_send_dbmail and the @Query parameter it fails with
the error below:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Mail',
@recipients = 'some.one@somewhere.com',
@query = 'select * from SAP_Staging.dbo.CustomerIDSequence',
@subject = 'Customer Cleansing Status',
@attach_query_result_as_file = 1,
@query_result_header = 1
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 478
Query execution failed: Msg 15404, Level 16, State 19, Server GB-S-0115,
Line 1
Could not obtain information about Windows NT group/user 'NMEA\GBNIROA1',
error code 0x5.
For your info:
1) I have applied my User Account to the DatabaseMailUserRole
2) Test mail works ok
3) the first query works ok
4) select * from SAP_Staging.dbo.CustomerIDSequence returns results
successfully
What am I missing? Any ideas
Nigel
>> Stay informed about: sp_send_dbmail: Error formatting query, probably invalid p..