Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sp_update_jobstep (e-mail notifications)

Status
Not open for further replies.

dBjason

Programmer
Mar 25, 2005
355
US
SQL Server 8


Hello,

I have a stored proc (below) which starts a job. What I'd like to do is add a second parameter (e-mail name) so whomever starts this job will be e-mailed when it completes. Currently someone else starts the job and I get notified when it's done.

Problem is I can't seem to reference this job property in the help files when I look up sp_update_jobstep.

Could it possibly be be under the @additional_parameters? Or does anyone know where I could look to find out?

Thanks,
Jason



Code:
CREATE procedure s_UnconsolidatedIncome_YardiGenerate_Run

@Year varchar(4)

as

Declare @LoadYear varchar(4)
Declare @StepCommand varchar(255)
Declare @JobName varchar(255)

Select @LoadYear = @Year
Select @StepCommand = 's_UnconsolidatedIncome_YardiGenerate ''' + @LoadYear + ''''
Select @JobName = 'Unconsolidated Income'


Exec msdb.dbo.sp_update_jobstep 	@job_name = @JobName, @step_id = 1,
   			@command = @StepCommand

Exec msdb.dbo.sp_start_job @job_name = @JobName
 
Notifications are done at the job level not the job step level.

Jobs can only send a notification to an operator, not to a passed email address.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 

Thanks Denny. I guess I'll have to xp_send_mail at the very end of the last stored procedure to e-mail the person who started it, and then have the job e-mail myself and my compadre on failure.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top