How to execute a job step based on outcome of previous SQL Agent job step?
There was a requirement to stop a SQL Server Agent job if any of the Staging Tables are not loaded in to Data warehouse
And to keep it simple and perform this action - I have added a step in SQL Server Agent Job to check Audit table to ensure all the Staging tables are loaded before loading them in to Data warehouse
DECLARE @dbState INT;
SELECT @dbState = RowCountCheck FROM [StagingDatabase].[vwEtlRowCountCheck]
WHERE RowCountCheck = 0
--AND TableName NOT IN ('Audit_Log', 'Config','CHARGES_DUE_PER_ASSET')
;
IF @dbState = 0
BEGIN
RAISERROR('All Staging tables are not loaded correctly', 11, 1);
END
Comments
Post a Comment