Modify Job name

  • How to rename all the job in an sql server 2005? I need to add the servername to the jobnames?

  • Hi balasach82,

    Lets say i have a job that is called Backup and my servername is BI-ONT this could be the query that you could use.

    Update msdb..sysjobs

    Set name = 'BI-ONT'+'_'+ name

    where name = 'Backup'

    If you don't use the Where clause de statement will update all your jobs.

    Don't forget to refresh your object explorer after all of this.

    Marbo

  • Don't update the system tables directly.

    Instead use sp_update_job passing in the old name and the new name.

  • Yes, i didnt want to update the systables directly. thats why wanted to find the best way to do this.

    Running the sp_update_job is the best method and no other "Accepted" way. Is it?

  • Yep, thats the documented way to do what you want to do.

  • Got below error:

    Cannot enable the Service Broker in database "msdb" because the Service Broker GUID in the database (XXXXX....) does not match the one in sys.databases (YYYYY.......).

    I dont have an clue whether the master/msdb was restored from another server.

    Can i create a new service broker. For this any precautions needed like i have to check all the existing service broker etc?

  • ALTER DATABASE XXX SET NEW_BROKER WITH ROLLBACK IMMEDIATE

    First stop everything that uses service broker in MSDB, like DBMail or anything you have created manually.

Viewing 7 posts - 1 through 6 (of 6 total)

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