Last active
April 24, 2019 15:49
-
-
Save LitKnd/274f48fae50327e87d7d05022db53473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Use this Post-Deployment script to perform tasks after the deployment of the project. | |
* Read more at https://www.red-gate.com/SOC7/post-deployment-script-help | |
*/ | |
--This is terrible tsql, it's written for a quick repro only | |
DECLARE @name NVARCHAR(2000); | |
IF | |
( | |
SELECT COUNT(*) | |
FROM msdb.dbo.sysjobs | |
WHERE name LIKE N'Test job created at%' | |
) > 0 | |
BEGIN | |
SELECT @name = name | |
FROM msdb.dbo.sysjobs | |
WHERE name LIKE N'Test job created at%'; | |
EXEC msdb.dbo.sp_delete_job @job_name = @name; | |
END; | |
SET @name = N'Test job created at ' + CAST(SYSDATETIME() AS VARCHAR) + N' by SCA'; | |
EXEC msdb.dbo.sp_add_job @job_name = @name, | |
@enabled = 0, | |
@description = N'Testing job in post deployment script', | |
@owner_login_name = N'sa'; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment