日期:2014-05-18 浏览次数:20477 次
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
------解决方案--------------------
执行下面的代码,将@@SERVERNAME的值修改为与SERVERPROPERTY('ServerName')一样即可。修改完成后,需要重新启动MSSQLSERVER服务使修改生效。 IF SERVERPROPERTY('ServerName')<>@@SERVERNAME BEGIN DECLARE @srvname sysname SET @srvname=@@SERVERNAME EXEC sp_dropserver @server=@srvname SET @srvname=CAST(SERVERPROPERTY('ServerName') as sysname) EXEC sp_addserver @server = @srvname , @local = 'LOCAL' END