Skip to content

Instantly share code, notes, and snippets.

@matt40k
Created May 7, 2018 07:43
Show Gist options
  • Save matt40k/f384b0791fbc18549618ed8fbf39c258 to your computer and use it in GitHub Desktop.
Save matt40k/f384b0791fbc18549618ed8fbf39c258 to your computer and use it in GitHub Desktop.
sp_dropserver <old_name>;
GO
sp_addserver <new_name>, local;
GO
DECLARE
@oldname varchar(255) = '<old_name>'
,@newname varchar(255) = '<new_name>';
UPDATE
msdb.dbo.sysjobsteps
SET
command = REPLACE(command, @oldname, @newname)
WHERE
command LIKE '%'+@oldname+'%';
select @@servername
DECLARE
@oldname varchar(255) = '<old_name>'
,@newname varchar(255) = '<new_name>';
UPDATE
OctopusDeploy.dbo.OctopusServerNode
SET
name = @newname
WHERE
name = @oldname;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment