if serverproperty('servername') <> @@servername
begin
declare @server sysname
set @server = @@servername
exec sp_dropserver @server,'droplogins'
set @server = cast(serverproperty('servername') as sysname)
exec sp_addserver @server = @server , @local = 'LOCAL'
end
重启数据库服务器,使用一下代码检验
use master
go
select @@servername
select serverproperty('servername')