none
Question on Disabling SQL Agent Job RRS feed

  • Question

  • Hi,

    We have a SQL Job that we want to get disabled for all errors but except for TCP/IP NETWORK ERRORS.

    Can we disable jobs but not disable for Network Issues.


    sami

    Friday, February 14, 2020 3:19 PM

All replies

  • Job don't get disabled when they fail, so I don't understand what you mean here?

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Friday, February 14, 2020 3:34 PM
  • Hi,

    We have a SQL Job that we want to get disabled for all errors but except for TCP/IP NETWORK ERRORS.

    Can we disable jobs but not disable for Network Issues.


    sami

    If a job fails you can add next step in job to disable the job, like 

    EXEC msdb.dbo.sp_update_job @job_name='job_name',@enabled = 0
    but I really dont know how to make this NOT work for TCP/IP error. May be what you are asking is not possible but I do not have clear answer on this.


    Cheers,

    Shashank

    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it

    My TechNet Wiki Articles

    MVP

    Friday, February 14, 2020 5:10 PM
  • Hi sami,

    --To disable the job, changes the name and description
    USE msdb ;  
    GO  
    
    EXEC dbo.sp_update_job  
        @job_name = N'NightlyBackups',  
        @new_name = N'NightlyBackups -- Disabled',  
        @description = N'Nightly backups disabled during server migration.',  
        @enabled = 0 ;  
    GO  

    If you post more information, we could get a right direction and make some test.

    Best Regards,

    Lily


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    • Edited by Lily Lii 13 hours 45 minutes ago
    13 hours 46 minutes ago