hi,
i am getting below error while executing sql querry with email as output.
Msg 102, Level 15, State 1, Line 77
Incorrect syntax near '@attach_query_result_as_file'.
i have checked for the , before the line 77 but still getting this error
Also is there any way i can run sql querry from other location like c:\testquerry.sql in the commands like below
===========
EXEC msdb.dbo.sp_send_dbmail
@recipients=N'abc.xyz@gmail.com',
@body='Query Results Are Attached',
@subject ='Query Results',
@profile_name ='TESTprofile',
@query ='c:\testquerry.sql',
@attach_query_result_as_file = 1,
@query_result_separator =',',
@query_attachment_filename ='QueryResults.txt'
Please revert if any solution.