Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Two Database server

Author  Topic 

niks
Starting Member

9 Posts

Posted - 2012-06-15 : 04:10:15
I am having two database, e.g. Database Server A and Database Server B

In A i have database ABC
In B I have Database ABD

i want to fire join query by connecting two DB server and to DB,

pls advice

Regds
Niks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-15 : 04:22:34
It's just a normal join, but use the 3-part naming convention.

DB1.dbo.Tbl1 for instance

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-06-15 : 04:38:30
2 different SQL Server ?

use Linked Server http://msdn.microsoft.com/en-us/library/ms188279.aspx

and use 4 part naming [Linked Server].[Database].[Schema].[Table]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-15 : 04:43:41
Ah! Missed it was two different database servers, thought it was just two databases on the same instance. That's what I get for responding to posts at 1:45am!

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -