Home  >  Article  >  Database  >  SQL Server数据库实例名与服务器名不一致的解决办法

SQL Server数据库实例名与服务器名不一致的解决办法

WBOY
WBOYOriginal
2016-06-07 17:59:022001browse

SQL Server数据库实例名与服务器名不一致的解决办法 1.--EXEC sp_addlinkedserver 2.-- @server = PSHGQ 3.--GO 4.--select * from sys.servers 5.--EXEC sp_dropserver PSHGQ 6.--EXEC sp_addserver SUGON, local 7.--select @@servername 8.--select server

SQL Server数据库实例名与服务器名不一致的解决办法

1.--EXEC sp_addlinkedserver   
2.--   @server = 'PSHGQ'   3.--GO   4.--select * from sys.servers   5.--EXEC sp_dropserver 'PSHGQ'   6.--EXEC sp_addserver 'SUGON', local   7.--select @@servername   8.--select serverproperty('servername')     9. 
10. 
11. 
12.use [数据库]      
13.go      
14.select @@servername     15.select serverproperty('servername')     16.go  
17.------     18.IF serverproperty('servername')@@servername       19.BEGIN     20.DECLARE @server SYSNAME     21.SET @server=@@servername         22.EXEC sp_dropserver @server=@server       23.SET @server=cast(serverproperty('servername') AS SYSNAME)      24.EXEC sp_addserver @server=@server,@local='LOCAL'        25.END     26.ELSE     27.PRINT '实例名与主机名一致,无需修改!'   
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn