To fix the error which occurs after the Windows server name been changed, when trying to update or delete the jobs previously created in a SQL Server 2000 instance, or attaching msdb database.
Error 14274: Cannot add, update, or delete a job (or its steps or schedules) that originated from an MSX server. The job was not saved.
Reason:
SQL Server 2000 supports multi-instances, the originating_server field contains the instance name in the format ‘server\instance’. Even for the default instance of the server, the actual server name is used instead of ‘(local)’. Therefore, after the Windows server is renamed, these jobs still reference the original server name and may not be updated or deleted by the process from the new server name. It’s a known problem with SQL2000 SP3.
Fix/Workaround/Solution:
In order to solve the problem you should perform the following steps:
From the Query Analyzer run following steps in order:
SELECT @@servername
and verify if it shows the correct SQL server name.
a) If not, run:
sp_dropserver <'name_returned'>
and then:
sp_addserver <'correct_servername'>, 'local'
to change the SQL server name.
Please restart SQL server service to let the new configuration takes effect.
b) If yes,
Please check the originating_server column in msdb..sysjobs by running:
SELECT *
FROM msdb..sysjobs
and verify if all jobs have the correct server name for originating_server.
If not, update this value with the correct server name by running following script
USE msdb
GO
DECLARE @server sysname
SET @server = CAST(SERVERPROPERTY('ServerName')AS sysname)
UPDATE sysjobs
SET originating_server = @server
WHERE originating_server = '<wrong_servername>'
Reference: Pinal Dave (http://www.SQLAuthority.com),
http://support.microsoft.com/default.aspx?scid=kb;en-us;281642












Dave,
Excellent write-up!
Got me out of a pretty good jam!
Thanks!!
Thanks Dear,
It solved my problem. Wish you a very happy life.
Regards,
Malik
Beautiful doc, excelent tip!
tks a lot!
Gabriel
I have to agree… Excellent, short and precise documentation.
Thanks,
Max
This worked well… I was relieved to a final clean-up of the olf jobs I couldn’t remove.
Spent and hour searching for alternatives on microsoft.
found this in 2 minutes. Ran it in 1 minute.
10,000 thank you’s!
Thank you very much! Excellent document Have a long live!! :-))
Great tip, solve my problem
Thank you very much
Dave,
Excellent and crystal article. THis solve my problem.
Thank you very much ! I solve my problem.
I hope you you have a very nice life
and God blesses you.
Thanks !!!!!!!!!!
It solved my problem!!!!!!!!!!
This document is very simple and very efficient.
Thank you,
So simple and yet so effective. Having read what Microsoft suggested and then doing this. I am speachless.
Thanks again you saved my day
Great trick Boss! It helped fix our problem!
Thank you for you solution, good job!
Luca
Many thanks. You answered what many could not.
It was wonderful. To be honest I am Oracle DBA but our company has few sql servers for support and I solved the problem with your tip. I wish a great life for you.
This blog was a big saviour!
Thanks a lot!
Praseedha S-India
Good artilce, it worked for me!
Thanks
Siva
Well done. Much better then MS fix!
Cheers,
Josh
congratulations you are my best friend…
Good solution – precise and direct. Thank you very much.
Microsoft should pay you for your support.
That was straight forward and precise and yes it did solve the problem and saves my day man….thanks a lot to all.
Thanks, I had renamed a SQL server and this helped me fix sql agent jobs afterwards.
Thanks for the nice tip. There’s been so many times where I’ve renamed a SQL server and forgotten about the jobs. My only known solution was to rename it back temporarily just to delete the jobs.
Thanks a lot for this! It was very helpful.
Just a note though, if you have MSDE, you might run into issues creating and using a variable. You can also use:
USE msdb
UPDATE sysjobs SET originating_server = @@servername
…IF you only have 1 instance and IF you correctly set the servername as the OP mentioned in part A.
Cheers,
Dan
What a time saver!
Thanks, I just migrated jobs from one server to another, and needed to quickly disable the jobs….and received an error. This has fixed my problem…thanks so much.
Thanks you very much !!!
Excellent Article! Keep it up.
Thanks
Thanks a lot !
I’m Thai people..
This good blog..
I will come agin..
Bye Bye ^_____^
Thank you very much. have a great day! :)
Hi Thanks a lot…..
Excellent write-up!!!!
It worked. Thanks.
thank you very much. helped me to solve my problem.
You are the Best!!!!
really helpfull!
Nice post…got me thinking and I could clean up some jobs that was copied from one server to another.
Thanks :)
Thanks heaps mate – help me overcome my problem
many blessing to you and your family
Dave, Thank you for this solution.
Thanks! I have implemented this fix successfully on SQL 2000 servers and now need to apply to a Sql 2005 server that was copied to another server. Unfortunately, the msdb.sysjobs table does not have an originating_server column in sql 2005. It is called originating_server_id. Is there a similiar fix for SQL 2005? Your assistance is greatly appreciated.
I ran your script but it gave me another error.
here is your script:
USE msdb
GO
DECLARE @server sysname
SET @server = CAST(SERVERPROPERTY(‘ServerName’)AS sysname)
UPDATE sysjobs
SET originating_server = @server
WHERE originating_server = ‘’
here is the error:
Server: Msg 515, Level 16, State 2, Line 3
Cannot insert the value NULL into column ‘originating_server’,
table ‘msdb.dbo.sysjobs’; column does not allow nulls. UPDATE fails.
The statement has been terminated.
Can you help
Thank you so much,
chen
beautiful…… thanks a lot.. simply brilliant
As a way of improvement….
use msdb
UPDATE sysjobs SET originating_Server = ‘new_servername’
Does the same thing as:
USE msdb
GO
DECLARE @server sysname
SET @server = CAST(SERVERPROPERTY(‘ServerName’)AS sysname)
UPDATE sysjobs
SET originating_server = @server
WHERE originating_server = ”
but it’s shorter. Less potential syntax issues as well.
Thanks, it solved the problem as soon as the steps were performed.
Thanks a lot… It saved me!!!
This was very easy and concise. Great write up. It helped out a lot
hi great write up,
what i did was a select:
SELECT *
FROM msdb..sysjobs
and then an update:
update msdb..sysjobs
set [originating_server] = ‘new_server_name’
where [originating_server] ‘new_server_name’
And then deleted it from the job schedule.
again good write up.
Gorgeous solution.
Thousand kisses from me.
Thanks a lot…
My case resolved too, after to apply last sugestion . This is error my jobs:
Server: Msg 515, Level 16, State 2, Line 3
Cannot insert the value NULL into column ‘originating_server’,
table ‘msdb.dbo.sysjobs’; column does not allow nulls. UPDATE fails.
The statement has been terminated.
Solution:
use msdb
UPDATE sysjobs SET originating_Server = ‘new_servername’
Thanks again!!!
To people getting the error message:
Server: Msg 515, Level 16, State 2, Line 3
Cannot insert the value NULL into column ‘originating_server’,
table ‘msdb.dbo.sysjobs’; column does not allow nulls. UPDATE fails.
The statement has been terminated.
Please do not alter the line:
SET @server = CAST(SERVERPROPERTY(‘ServerName’)AS sysname)
You should leave ‘ServerName’ as it is. You should not replace it with your own server name.
Regards
Great work, this really helped me out. Short and precise, do not find that much with us geeks, always want too much info in there! (myself included) Thanks again.
Dude! You are a GENIUS!
Thanks, solved my problem
THANKS a million!
Have just realised this seems to be a bug introduced in SQL2000 SP3 and not fixed in SP4.
Just waiting for permission to restart SQL on the affected box!
many thanks
J
Absolutely spot on – many thanks!!
Thank you for this, saved me!
Hey this was great, I did a small modification which takes care of all jobs that where not on this server by doing the following:
USE msdb
GO
DECLARE @server sysname
SET @server = CAST(SERVERPROPERTY(‘ServerName’)AS sysname)
PRINT @server
SELECT *
FROM msdb..sysjobs WHERE originating_server @server
UPDATE sysjobs
SET originating_server = @server
WHERE originating_server @server
the change is minor but it guarantees only changing those jobs that were not created on the new server
Thanks, worked like a charm!
Hi Dave,
I still having the following error when trying to delete a job even though the value of @@servername and originating_server is the same :
“Error 14274: Cannot add, update, or delete a job (or its steps or schedules) that originated from an MSX server”
select @@servername
AMCDE\VAULINETIX
SELECT originating_server FROM msdb..sysjobs
AMCDE\VAULINETIX
appreciate yr help. thanks
Thanks so much!
Worked perfectly
Thanks so much. Fixed my problem too.
Really, really, great work! You helped me sooo much!
Thanks a lot!
JSK
Great…Thanks for your help
Thanks a load… You’re GREAT
Just what I needed! You’re the best!
I just ran it like this
DELETE
FROM msdb..sysjobs
and it took them all off for me, if you don’t want to remove them all then put the name of the backup like
DELETE backup1
FROM msdb..sysjobs
This worked really well for me
Thank you very much
This works perfectly. Thanks a lot for always sharing useful stuff!!
Thanks Pinal. Worked well and saved a lot of time.
TY Pinal.
Thank you. This is just one of your posts that really helped me.
We restored an image of our server so all jobs goofed up because of server renamed. And your solution just worked like a charm.
Best wishes to you.
You are superb.. Pinal
Thanks a lot..
Thanx Matey!
This is still very effective after all these years. Thank you for writing it.
Thanks!!
This worked perfectly. Many thanks! Both my production server and standby server names have been set properly. Thanks Again, Ed K
Thanks
Pinal, by any chance do you happen to know Sumit Dave?
He looks remarkabally like you.. just like your long lost brother. Have you been to kumbh?
- KK
Fabulous… worked just as expected… 5 stars for this effort
Worked like a charm for meon a clone of an existing server with another name.
Thanks a lot
Great Job!! Problem solved. Thanks a lot.
I’ve bumped this issue just today while maintaining an acient sql2000 instance. Thanks again!
Bumped and resolved the same issue today while maintaining an ancient SQL2000 server. Thanks again!
Hi, Thank you for help.
Excelent.
Santos, Clayton A
As a database working in SQL Server is tough and learning something new about some new errors will add an extra advantage to solve this error without much tiresome troubles.
Thank so much! This’s very helpful :)
Hi Pinal,
It worked awesome for me.
Thanks a lot for this type helpful documents.
Perfect. Thank you.
[...] SQL SERVER – Fix : Error 14274: Cannot add, update, or delete a job (or its steps or schedules) th… This is one error every single developer who have ever upgraded SQL Server to the latest version would have faced it – I was glad to have the solution of this out early in my career as I had upgraded my system around the same time from SQL Server 2000 to SQL Server 2005. [...]
[...] « SQL SERVER – Cursor to Kill All Process in Database SQL SERVER – Fix : Error 14274: Cannot add, update, or delete a job (or its steps or schedules) th… » [...]