数据库服务名 实例名 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