码迷,mamicode.com
首页 > 数据库 > 详细

20160712001 SQL server R2 更名

时间:2016-07-12 15:29:21      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

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‘


__________________________________________________________________

20160712001 SQL server R2 更名

标签:

原文地址:http://www.cnblogs.com/hutie1980/p/5663551.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!