Painting Blue Code
Simple, self-explanatory code snippets.
2019-07-03
TSQL - Delete a job if it exists
IF
EXISTS(
SELECT
1
FROM
[msdb]
.
[dbo]
.
[sysjobs] a
WITH
(
NOLOCK
)
WHERE
a
.
Name
=
'JOB_NAME_HERE'
)
EXEC
sp_delete_job
@job_name
=
'JOB_NAME_HERE'
,
@delete_unused_schedule
=
1
;
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment