Solved

sp_send_dbmail sends blank email as a scheduled report

Posted on 2011-09-21
3
289 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

10 Experts available now in Live!

Get 1:1 Help Now