Solved

sp_send_dbmail sends blank email as a scheduled report

Posted on 2011-09-21
3
323 Views
Last Modified: 2013-03-22
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
Comment
Question by:bccops
3 Comments
 
LVL 25

Expert Comment

by:TempDBA
ID: 36574429
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
 
LVL 21

Accepted Solution

by:
JestersGrind earned 500 total points
ID: 36574440
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
 
LVL 5

Expert Comment

by:VENKAT KOKULLA
ID: 36716370
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL help 5 56
PERFORMANCE OF SQL QUERY 13 76
Grid querry results 41 80
View SQL 2005 Job package 16 70
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question