I am trying to find a way to automatize SQL query. I tested the query and it works fine so I want now to set it up as a job on SQL server. What is the best way to email result of query via automatic process from SQL server. I can set up query as stored procedure and than set up a job on schedule but how would I email the result of query to someone? I was able to find this stored procedure
sp_send_dbmail
but from online reading I found that opening this ability is opening SQL server to security attacks.
Can anyone suggest other options or what would common practice be in functionality that I need to implement which is export result of query once a day to email recipient.
Thanks