Home > Database > Mysql Tutorial > 设置SQL Server命名实例为默认实例

设置SQL Server命名实例为默认实例

WBOY
Release: 2016-06-07 16:16:34
Original
2512 people have browsed it

SELECT @@SERVERNAME,SERVERPROPERTY('SERVERNAME') --默认实例 USE master GO --设置两个变量 DECLARE @serverproperty_servername varchar(100),@servername varchar(100) --取得Windows NT 服务器和与指定的 SQL Server 实例关联的实例信息 SELECT @serve

SELECT @@SERVERNAME,SERVERPROPERTY('SERVERNAME')
--默认实例

USE master
GO

--设置两个变量
DECLARE @serverproperty_servername varchar(100),@servername varchar(100)

--取得Windows NT 服务器和与指定的 SQL Server 实例关联的实例信息
SELECT @serverproperty_servername = CONVERT(varchar(100), SERVERPROPERTY('ServerName'))

--返回运行 Microsoft SQL Server 的本地服务器名称
SELECT @servername = CONVERT(varchar(100), @@SERVERNAME)

--显示获取的这两个参数
SELECT @serverproperty_servername,@servername

--如果@serverproperty_servername和@servername不同(因为你改过计算机名字),再运行下面的

--删除错误的服务器名
EXEC sp_dropserver @server=@servername

--添加正确的服务器名
EXEC sp_addserver @server=@serverproperty_servername, @local='local'

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template