Home > Database > Mysql Tutorial > body text

同一个sql语句 连接两个数据库服务器

WBOY
Release: 2016-06-07 17:58:56
Original
1641 people have browsed it

在sqlserver查询分析器中,一个sql语句连接两个数据库服务器的一种方法

exec sp_addlinkedserver '逻辑名称','','SQLOLEDB','远程服务器名或ip地址'
exec sp_addlinkedsrvlogin '逻辑名称','false',null,'用户名','密码'
go

建立完成之后就可以正常使用了

select * from 逻辑名称。数据库名称。dbo。表名称 这是一个完整的sql语句

使用完成之后要,删除掉建立的虚拟连接

exec sp_dropserver '逻辑名称','droplogins'
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!