Solved

sp_send_dbmail sends blank email as a scheduled report

Posted on 2011-09-21
3
301 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server DeDupe Table 3 39
How to check data in sql table 11 45
Isolation level in SQL server 3 47
Replace Dates in query 14 21
There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now