原因是:之前修改过服务器实例名称执行一下语句
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
再执行一下语句
select @@servername
select SERVERPROPERTY ('servername')
看到两个结果是一致了,就OK了