Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Provides the number of jobs that a schedule is attached to.
Transact-SQL syntax conventions
sp_help_jobcount
[ [ @schedule_name = ] N'schedule_name' ]
[ , [ @schedule_id = ] schedule_id ]
[ ; ]
The identifier of the schedule to list. @schedule_id is int, with no default.
Either @schedule_id or @schedule_name can be specified.
The name of the schedule to list. @schedule_name is sysname, with no default.
Either @schedule_id or @schedule_name can be specified.
0
(success) or 1
(failure).
Returns the following result set:
Column name | Data type | Description |
---|---|---|
JobCount |
int | Number of jobs for the specified schedule. |
This procedure lists the number of jobs attached to the specified schedule.
You can grant EXECUTE
permissions on this procedure, but these permissions might be overridden during a SQL Server upgrade.
Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb
database:
For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.
Only members of sysadmin can view counts for jobs that are owned by others.
The following example lists the number of jobs attached to the NightlyJobs
schedule.
USE msdb;
GO
EXEC sp_help_jobcount
@schedule_name = N'NightlyJobs';
GO
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!