连接不同数据库中的表 [英] Joining tables in different databases
本文介绍了连接不同数据库中的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我正在开发一个ASP项目,客户希望能够有效地执行SELECT查询来连接两个不同的表
数据库(位于同一个SQL-Server上)。
这是否涉及创建链接到另一个数据库的虚拟表,或者
am我完全走错了轨道?
任何关于我可能在哪里可以找到更多信息(嗡嗡声等等)的提示将会是
be非常感谢。
谢谢
Hi
I''m working on an ASP project where the clients want to be able to
effectively perform SELECT queries joining tables from two different
databases (located on the same SQL-Server).
Does this involve creating virtual tables that link to another database, or
am I completely on the wrong track?
Any hints as to where I might find more information (buzz-words, etc.) would
be most appreciated.
Thanks
推荐答案
尝试''四个部分名'')。
server.database.owner.table
MC
船长Nemo <是ne ** @ nospam.com>在留言中写道
news:6o **************** @ text.news.blueyonder.co.uk ...
Try ''four part names'' :).
server.database.owner.table
MC
"Captain Nemo" <ne**@nospam.com> wrote in message
news:6o****************@text.news.blueyonder.co.uk ...
嗨
我正在开发一个ASP项目,客户希望能够有效地执行SELECT查询,从两个不同的数据库连接表(位于同一个数据库中) SQL-Server)。
这是否涉及创建链接到另一个数据库的虚拟表,
或
我是否完全走错了路?
任何关于我可能在哪里找到更多信息(嗡嗡声等等)
的提示都将非常受欢迎。
谢谢
Hi
I''m working on an ASP project where the clients want to be able to
effectively perform SELECT queries joining tables from two different
databases (located on the same SQL-Server).
Does this involve creating virtual tables that link to another database,
or
am I completely on the wrong track?
Any hints as to where I might find more information (buzz-words, etc.)
would
be most appreciated.
Thanks
使用3部分命名:
选择
*
来自
dbo.MyTable l
加入
OtherDB.dbo.OtherTable o on o.PK = l.PK
>
-
汤姆
---------------------- ------------------------------
Thomas A. Moreau,理学士,博士,MCSE,MCDBA
SQL服务器MVP
专栏作家,SQL Server专业版
加拿大多伦多
www.pinpub.com
Nemo船长 <是ne ** @ nospam.com>在留言中写道
news:6o **************** @ text.news.blueyonder.co.uk ...
您好
我正在开发一个ASP项目,客户希望能够有效地执行SELECT查询来连接两个不同的表格$>
数据库(位于同一个SQL-Server上)。
这是否涉及创建链接到另一个数据库的虚拟表,或者
我完全走错了路吗?
任何关于我可能在哪里可以找到更多信息(嗡嗡声等等)的提示都会非常感激
。
谢谢
Use 3-part naming:
select
*
from
dbo.MyTable l
join
OtherDB.dbo.OtherTable o on o.PK = l.PK
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
"Captain Nemo" <ne**@nospam.com> wrote in message
news:6o****************@text.news.blueyonder.co.uk ...
Hi
I''m working on an ASP project where the clients want to be able to
effectively perform SELECT queries joining tables from two different
databases (located on the same SQL-Server).
Does this involve creating virtual tables that link to another database, or
am I completely on the wrong track?
Any hints as to where I might find more information (buzz-words, etc.) would
be most appreciated.
Thanks
OP说两个DB'在同一台服务器上。因此,3部分命名
就足够了。
-
Tom
------------------------------------------------ ----
Thomas A. Moreau,理学士,博士,MCSE,MCDBA
SQL Server MVP
专栏作家,SQL Server专业人员
加拿大多伦多
www.pinpub.com
" MC" < marko_culo#@#雅虎## COM#>。在消息中写道
news:dr ********** @ magcargo.vodatel.hr ...
试试''四部分名'': )。
server.database.owner.table
MC
Nemo船长 <是ne ** @ nospam.com>在留言中写道
news:6o **************** @ text.news.blueyonder.co.uk ...
The OP said the two DB''s were on the same server. Therefore, 3-part naming
is sufficient.
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
"MC" <marko_culo#@#yahoo#.#com#> wrote in message
news:dr**********@magcargo.vodatel.hr...
Try ''four part names'' :).
server.database.owner.table
MC
"Captain Nemo" <ne**@nospam.com> wrote in message
news:6o****************@text.news.blueyonder.co.uk ...
嗨
我正在开发一个ASP项目,客户希望能够有效地执行SELECT查询,从两个不同的数据库连接表(位于同一个数据库中) SQL-Server)。
这是否涉及创建链接到另一个数据库的虚拟表,
或
我是否完全走错了路?
任何关于我可能在哪里找到更多信息(嗡嗡声等等)
的提示都将非常受欢迎。
谢谢
Hi
I''m working on an ASP project where the clients want to be able to
effectively perform SELECT queries joining tables from two different
databases (located on the same SQL-Server).
Does this involve creating virtual tables that link to another database,
or
am I completely on the wrong track?
Any hints as to where I might find more information (buzz-words, etc.)
would
be most appreciated.
Thanks
这篇关于连接不同数据库中的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文