机器名修改

 

USE MASTER
GO

SELECT @@servername
SELECT SERVERPROPERTY('servername')

IF SERVERPROPERTY('servername') <> @@servername
BEGIN
DECLARE @server SYSNAME
SET @server = @@servername
EXEC sp_dropserver @server = @server
SET @server = CAST(SERVERPROPERTY('servername') AS SYSNAME)
EXEC sp_addserver @server = @server,
@local = 'LOCAL'
END

posted @ 2011-08-01 09:59  qanholas  阅读(219)  评论(0编辑  收藏  举报