Home > Database > Mysql Tutorial > body text

sqlserver 多库查询 sp_addlinkedserver使用方法(添加链接服务

WBOY
Release: 2016-06-07 18:02:17
Original
2119 people have browsed it

mssql在使用多库查询的时候会用到链接服务器,以下为链接服务器的添加方法,添加完了即可实现任意改服务器的多库查询了

Exec sp_droplinkedsrvlogin ZYB,Null --删除映射(录与链接服务器上远程登录之间的映射)
Exec sp_dropserver ZYB --删除远程服务器链接

EXEC sp_addlinkedserver
@server='ZYB',--被访问的服务器别名
@srvproduct='',
@provider='SQLOLEDB',
@datasrc="/Server2" --要访问的服务器


EXEC sp_addlinkedsrvlogin
'ZYB', --被访问的服务器别名
'false',
NULL,
'sa', --帐号
'sa' --密码

使用实例:
Select * from ZYB.CDCenter20110822.dbo.cardbase
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