Solved

strored procedure doesn't send mail on job but does when manually run

Posted on 2014-09-03
2
187 Views
Last Modified: 2014-09-03
I have this scheduled to run every 4 hours. The stored procedure it calls send an email and dumps data. The procedure dumps the data in ok but doesn't send an email using EXEC msdb.dbo.sp_send_dbmail with the job. The email sends when I manually run it however. Not sure what is wrong.


USE [db]
GO

DECLARE      @return_value int

EXEC      @return_value = [dbo].[UPDATE_my_STATS]

SELECT      'Return Value' = @return_value

GO
0
Comment
Question by:cseink
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40300699
if it runs when started manually, but fails when running from a JOB, it's simply a permission problem (against the network!)

when running manually, you are running it with your logged in permissions
when running as job, it's the SQL agent process that runs by default under a localsystem permissions, which has NO permissions to do anything across the network. hence, you need to change this:
http://msdn.microsoft.com/en-us/library/ms191543.aspx
0
 

Author Closing Comment

by:cseink
ID: 40300706
Thanks! Didn't even think about that.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

705 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