The following 2 methods show how to enable / disable and SQL server agent jobs programmatically.
To Enable a Job:
UPDATE
MSDB.dbo.sysjobs
SET
Enabled = 1
WHERE Name = ‘JOB_NAME’;
To Disable a Job:
UPDATE
MSDB.dbo.sysjobs
SET
Enabled = 0
WHERE Name = ‘JOB_NAME’;
Archive for July, 2009
How to Disable Or Enable SQL Server Jobs Programmatically
July 31, 2009SQL – Check If One String Contains Another String (CHARINDEX)
July 28, 2009The CHARINDEX() function returns the location of a search string within another string.
For Example:
This code will return 8, which equates to the position of ’sentance’ within the string ‘This is a sentance’.
select charindex(’sentance’,’This is a sentance’)
This can be used to check if string A is contained in String B by using the following command:
select * from [...]