从两个数据库检索数据 [英] Retrieving data from two databases
本文介绍了从两个数据库检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从两个数据库中检索数据.
请给我发送代码.
I want to retrieve data from two databases.
plz send me code.
推荐答案
尝试一下,
Try this,
select * from db1.dbo.table_db1 as A, db2.dbo.table_db2 as B where A.Bank_ID = B.Bank_ID
如果仅用于联接,则可以将JOIN与SELECT查询一起使用
从不同的数据库中选择数据 [ OPENROWSET [ OPENDATASOURCE [链接的服务器 [
if just for join you can use JOIN with SELECT query
Selecting data from different databases[^]
[For SQL Server]If databases are in different locations or types then
use OPENROWSET[^]
or
OPENDATASOURCE[^]
or
Linked Servers[^]
这篇关于从两个数据库检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文