?
Solved

sp_add_jobschedule  question

Posted on 2004-11-29
9
Medium Priority
?
1,124 Views
Last Modified: 2012-05-05
what should the @name parameter be set to in the sp_add_jobschedule ?
I understand @job_name is the nameof the job.
@name is the name of the scheduled job-a ren't they both the same?
how can i find the name of my scheduled job?
0
Comment
Question by:ams7503
  • 5
  • 4
9 Comments
 
LVL 18

Expert Comment

by:SjoerdVerweij
ID: 12701445
@Name is the name of the schedule. Jobs have names, steps have names, and schedules have names.

To see names for existing schedules for a job:

exec msdb..sp_help_jobschedule @job_name = 'insertyourjobnamehere'

Random question: why not use Enterprise Manager?

0
 

Author Comment

by:ams7503
ID: 12702500
i would like to use sp_help_jobschedule , to find out ststus of jobs being run.
0
 

Author Comment

by:ams7503
ID: 12706955
Thanks for the help. I tried the sp_help_jobschedule to get the schedule name.
When I use it as
EXEC msdb.dbo.sp_add_jobschedule @job_name ='TempPackage',
 @name = 'TestSchedule',
  @active_start_time=173500

I get the foll error:

Server: Msg 14261, Level 16, State 1, Procedure sp_add_jobschedule, Line 47
The specified @name ('TestSchedule') already exists.


How can i fix it?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 18

Expert Comment

by:SjoerdVerweij
ID: 12707671
Ah. If you want the status, just use

Exec MSdb..sp_help_job @job_name = 'TempPackage'
0
 

Author Comment

by:ams7503
ID: 12708210
Sorry, I meant to also update the schedule of the job, hence need to know the schedule name.
However,
I get the foll error:

Server: Msg 14261, Level 16, State 1, Procedure sp_add_jobschedule, Line 47
The specified @name ('TestSchedule') already exists.

Since, I want to change the schedule for TestSchedule, run it on a different time, or day.

0
 
LVL 18

Accepted Solution

by:
SjoerdVerweij earned 120 total points
ID: 12708283
Ah... if you want to CHANGE the schedule, use sp_update_jobschedule instead (syntax is fairly similar... look in Books Online).
0
 

Author Comment

by:ams7503
ID: 12708514
thanks.
sp_update_jobschedule works fine.

does sp_help_job show the last_run_outcome of the latest run schedule,alone.
since the result set for each of the schedules does not indicate the status of the schedule.
however, the result set of the overall job indicates the last_run_outcome

Is there any sp which indicates the status for each job schedule
0
 
LVL 18

Expert Comment

by:SjoerdVerweij
ID: 12708674
I don't think so. You might want to try jobhistory.
0
 

Author Comment

by:ams7503
ID: 12708796
ok thank you
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

807 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