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
 General SQL Server Forums
 New to SQL Server Programming
 Query from Multiple Instances of SQL server

Author  Topic 

sneupane
Starting Member

28 Posts

Posted - 2010-08-30 : 09:52:52
Hi everyone,

I am trying to query from two instances of sql servers. One instance is MS SQL server 2008 and next is MS SQL server 2005 express edition.
----------------------------
My query is like this

Select a,b,c,d
from tab1,tab2
where
tab1.a=tab2.c

I am getting an error

Msg 208, Level 16, State 1, Line 1
Invalid object name 'XYZ.dbo.ABC$tab1'.
----------------------------

In the above query table 1 is from SQL 2008 server and table 2 is from SQL 2005 express edition.




Sar

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-30 : 09:55:37
add one of instance as a linked server to other and then use four part naming convention as above

see

http://www.jayceooi.com/2009/10/08/add-linked-server-on-microsoft-sql-2008/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-30 : 09:55:53
You will have to create a linked server between them.
Then use full four-part naming convention in your query.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -