“Cannot add, update, or delete a job (or its steps or schedules) that originated from an MSX server.” +”originating_server_id”

I got this error when doing the following. I did right-click ‘Create Job as” then “Create to” a new query window. I was scripting 3 SQL agent jobs, then tried to combine them into one script.

I was trying to build my script without any “GO” commands, so I could have some variables at the top used throughout as parameters.

It was critical to reset these variables before each call to sp_add_job:
SET @ReturnCode = null
SET @jobID = null

The other “hits” I found when googling were totally off target of my solution above. I’m using SQL 2005, which seems to have an “originating_server_id” instead of an “originating_server” in the sysjobs table.

Hope this helps someone!

Neal

Tagged with:

Filed under: SQL