Alter the existing job using quey analyzer

  • I want to add one new step in existing SQL job. Th step needs to be included between two existing step. How to alter job using query analyzer.

    I know we can do it from SMS; but required the alter job script like alter table.

  • Script your job into new window of QA, add new code and run the script - your job will be re-created with new step.

  • Hi,

    I need command like 'Alter Table' . Is this any such command

  • There is nothing like ALTER JOB command.

    But when you script your job as CREATE TO ... You will have full script, which will recreate a job for you. If you include your code for extra step, you will recreate a job with this extra step.

  • Sergey Vavinskiy (9/21/2009)


    There is nothing like ALTER JOB command.

    But when you script your job as CREATE TO ... You will have full script, which will recreate a job for you. If you include your code for extra step, you will recreate a job with this extra step.

    Actually that isnt correct, you can use sp_addjobstep to add an additional step. or if you wanted to modify certain attributes of the job you could use sp_update_job.

    However it is easier like suggested to do it through the GUI and script it out that way if you can.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Silverfox (9/21/2009)

    Actually that isnt correct, you can use sp_addjobstep to add ...

    The author was loking for solution like ALTER JOB..., that is why I sugested a similar way.:-)

  • I concur "sp_add_jobstep" is the method i know of for scripting. I have similar question, but need to add a job step following a specific existing job step BY NAME (not stepid), then, need to ensure subsequent existing job steps are incremented - doesnt look to me like sp_add_jobstep will handle this automatically. Any solutions exist besides coding out the lookup and stepid increment logic?

  • Why not just edit the job in Management Studio? You can just add a new step and then place it where ever you need it to be.:-)

  • SOX requirements. We're supposed to script as much as possible and it runs through 2 layers of testing. This way database operations team doesn't have to "think" about it and just execute - minimize human error. Also cannot count on each environment to have identical job properties due to other various testing ongoing.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply