I am trying to Execute Query/SP from my local machine which SQL 2008R2 To SQL 2000 32 bit.
Created Linked Server from Local machine to SQL2000 Machine..
Query /SP run fine from SSMS but when I am trying to run through this below script keep giving me error .
I converted Select query into SP
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL-MailAlerts',
@recipients = '**********',
@query = 'EXEC dbo.QueryResult',
@query_attachment_filename = 'result.csv',
@attach_query_result_as_file = 1,
@body_format = 'text' ;
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
Linked servers cannot be used under impersonation without a mapping for the impersonated login.
Basically trying to get Query result from SQL 2000 Database into mail if anyone has better idea let me know.
Thanks
Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah