20160712001 SQL server R2 更名

时间:2022-05-30 00:18:07

use master
go
select @@servername;
select serverproperty('servername')

sp_dropserver 'BPM-SERVER'
go
sp_addserver 'BPM','local'

__________________________________________________________________

use master
go
select @@servername
select serverproperty('servername')

select * from msdb.dbo.MSdistpublishers
DELETE FROM msdb.dbo.MSdistpublishers
select * from msdb.dbo.MSdistpublishers
exec sp_droplinkedsrvlogin 'BPM-SERVER',null
exec sp_dropserver 'BPM-SERVER', 'droplogins'

USE master
 GO
 if serverproperty('BPM') <> @@servername 
begin 
       declare @server sysname 
       set   @server = @@servername 
       exec sp_dropserver @server = @server 
       set   @server = cast(serverproperty('BPM') as sysname) 
       exec sp_addserver @server = @server , @local = 'LOCAL' 
end

sp_dropserver 'BPM-SERVER'
go
sp_addserver 'BPM','local'

__________________________________________________________________