Add updated SqlAgent folder
This commit is contained in:
56
SqlAgent/03_Prod/4_Job_Maintenance/JobDependenciesDML.sql
Normal file
56
SqlAgent/03_Prod/4_Job_Maintenance/JobDependenciesDML.sql
Normal file
@ -0,0 +1,56 @@
|
||||
USE [ProdDUTASJobSchedule];
|
||||
GO
|
||||
|
||||
/**************************************************************************************************
|
||||
-- FILE: JobDependencies.sql
|
||||
-- PURPOSE: Manage JobDependencies table - Create, Read, Update, Delete for a single dependency
|
||||
-- TABLE: dbo.JobDependencies
|
||||
**************************************************************************************************/
|
||||
|
||||
-------------------------------
|
||||
-- SELECT - View Dependency
|
||||
-------------------------------
|
||||
SELECT *
|
||||
FROM [dbo].[JobDependencies]
|
||||
WHERE [JobName] = N'PROD_DAILY_DTSGSID0';
|
||||
GO
|
||||
|
||||
-------------------------------
|
||||
-- INSERT - Create Dependency
|
||||
-------------------------------
|
||||
INSERT INTO [dbo].[JobDependencies]
|
||||
(
|
||||
[JobName],
|
||||
[PredecessorJobName]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
N'PROD_DAILY_DTSGSID0', -- Dependent job
|
||||
N'PROD_DAILY_DTSBX305' -- Predecessor job
|
||||
);
|
||||
GO
|
||||
|
||||
-------------------------------
|
||||
-- UPDATE - Modify Dependency
|
||||
-------------------------------
|
||||
UPDATE [dbo].[JobDependencies]
|
||||
SET [PredecessorJobName] = N'PROD_DAILY_DTSBX215'
|
||||
WHERE [JobName] = N'PROD_DAILY_DTSGSID0'
|
||||
AND [PredecessorJobName] = N'PROD_DAILY_DTSBX305';
|
||||
GO
|
||||
|
||||
-------------------------------
|
||||
-- DELETE - Remove Dependency
|
||||
-------------------------------
|
||||
DELETE FROM [dbo].[JobDependencies]
|
||||
WHERE [JobName] = N'PROD_DAILY_DTSGSID0'
|
||||
AND [PredecessorJobName] = N'PROD_DAILY_DTSBX215';
|
||||
GO
|
||||
|
||||
-------------------------------
|
||||
-- SELECT - View Dependency
|
||||
-------------------------------
|
||||
SELECT *
|
||||
FROM [dbo].[JobDependencies]
|
||||
WHERE [JobName] = N'PROD_DAILY_DTSGSID0';
|
||||
GO
|
||||
Reference in New Issue
Block a user