sqlserver修改计算机名称。


SELECT @@SERVERNAME As [@@SERVERNAME], CAST(SERVERPROPERTY(‘MACHINENAME‘) AS VARCHAR(128)) + COALESCE(‘\‘ + CAST(SERVERPROPERTY(‘INSTANCENAME‘) AS VARCHAR(128)), ‘‘) As RealInstanceName


DECLARE @InternalInstanceName sysname;
DECLARE @MachineInstanceName sysname;

SELECT @InternalInstanceName = @@SERVERNAME, @MachineInstanceName = CAST(SERVERPROPERTY(‘MACHINENAME‘) AS VARCHAR(128)) + COALESCE(‘\‘ + CAST(SERVERPROPERTY(‘INSTANCENAME‘) AS VARCHAR(128)), ‘‘);

IF @InternalInstanceName <> @MachineInstanceName
BEGIN -- Rename the instance
EXEC sp_dropserver @InternalInstanceName;
EXEC sp_addserver @MachineInstanceName ,‘LOCAL‘
END
print @@servername

sqlserver修改计算机名称。

上一篇:mysql管理工具(python)


下一篇:JAVA学习之 将xml导入到数据库