• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

sp_send_dbmail sends blank email as a scheduled report

If I run a query that sends the result as an email it works perfect. If I make it a job and fire the job manually, fine again. If I put the job on a schedule it mails the report at the proper time, but its blank without results. The query is obviously identical in each case so this makes no sense. The only diffence is the addition of the schedule. Any ideas?
0
bccops
Asked:
bccops
1 Solution
 
TempDBACommented:
The addition of the schedule has nothing to do here. Check the account with which the job runs.. When you are running manually, it will use your credential. But the job execution will run on the owners credential. Seems like the output query by the job owner account is not returning anything, may be permission problem.
0
 
JestersGrindCommented:
It sounds like a permissions issue.  When you ran it as a query or you ran the job, it ran under your credentials.  When it runs on a schedule, it runs under the credentials of the owner of the job, unless the owner is a sysadmin.  In that case, it runs under the account that the SQL Server Agent is running as.  Or you can go under the advanced properties of the step and explicitly set a user for the job to run as.

Greg

0
 
VENKAT KOKULLASQL Server DBACommented:
I'm also faced same issue, the thing is that the particular folder which having results file doesn't having proper rights. And also give the complete rights for the SQL server folder that has installed on the drive.

If not try to change the result path location then try again. These are my guess try out this.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now