Job Name Function

Jen McCown has written a function to simplify getting SQL Agent job names:

So yeah, now it takes fewer keystrokes to get the job name. I used to:

SELECT *
FROM msdb..sysjobschedules
WHERE job_id IN ( SELECT job_id
FROM msdb..sysjobs
WHERE name LIKE ‘CollectorDBFilePropertiesGet-%’ );

But now I:

SELECT *
FROM msdb..sysjobschedules
WHERE dbo.JobName(job_id) LIKE ‘CollectorDBFilePropertiesGet-%’ ;

Jen’s got the function available on her site.

Related Posts

Spotting SQL Agent Job Differences

Rob Sewell shows us how to compare SQL Agent jobs across Availability Group replicas: On the plane home from PAS Summit I was sat next to someone who had also attended and when he saw on my laptop that I was part of the SQL Community we struck up a conversation. He asked me how […]

Read More

Using Tokens In SQL Agent Jobs

Raul Gonzalez builds a SQL Agent job and uses the JOBID token to help him log step output effectively: It’s usually a good idea to write the output of your SQL Agent jobs to a file, so you can investigate should any issue occur. But when you define the output file, you need to choose […]

Read More

Categories

March 2016
MTWTFSS
« Feb Apr »
 123456
78910111213
14151617181920
21222324252627
28293031