dbTalk Databases Forums  

Activat(Deactivate a scheduled dts job with t-sql

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Activat(Deactivate a scheduled dts job with t-sql in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michel
 
Posts: n/a

Default Activat(Deactivate a scheduled dts job with t-sql - 06-29-2006 , 04:38 AM






Hi

Is it possible to activate or deactivate a scheduled DTS job with a t-sql
script?

Thanks for some thoughts

Michel



Reply With Quote
  #2  
Old   
Davide
 
Posts: n/a

Default Re: Activat(Deactivate a scheduled dts job with t-sql - 06-29-2006 , 07:25 AM







Michel wrote:
Quote:
Hi

Is it possible to activate or deactivate a scheduled DTS job with a t-sql
script?

Thanks for some thoughts

Michel

Hi you could use this:


USE msdb

DECLARE @enabled int
DECLARE @jobname varchar(255)

SET @enabled = 0 --(0 to disable, 1 to enable)
SET @jobname = 'thenameofmyjob'

UPDATE sysJobSchedules
SET enabled = @enabled
FROM
(SELECT s.* FROM sysJobSchedules s
JOIN sysjobs j
ON j.job_id = s.job_id
AND j.name = @jobname
) AS sj
WHERE sysJobSchedules.job_id = sj.job_id


Note: This disable\enable all possible schedulations of the indicated
job

Bye



Reply With Quote
  #3  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Activat(Deactivate a scheduled dts job with t-sql - 06-29-2006 , 08:02 PM



Check sp_update_job in SQL Server Books Online. You can
disable a job using this, something like:
EXEC sp_update_job @job_name = 'YourJobName',
@enabled = 0

-Sue

On Thu, 29 Jun 2006 11:38:19 +0200, "Michel"
<michel_mueller (AT) bluewin (DOT) ch> wrote:

Quote:
Hi

Is it possible to activate or deactivate a scheduled DTS job with a t-sql
script?

Thanks for some thoughts

Michel



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.