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 2000 Forums
 SQL Server Development (2000)
 Query Multiple databases

Author  Topic 

marcuscoker
Starting Member

13 Posts

Posted - 2006-09-13 : 08:36:11
Hi

Was wondering if anybody could help. I was wondering what the syntax would be to query a table that is sitting in another database.

So

select *
from dbo.clients

How would i ammend the query to say dbo.Clients in Database2

Thanks

Marcus

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-09-13 : 08:40:57
If the databases are on the same server..
Select * From Database2.dbo.Clients
Or
Select * From Database2..Clients

If the databases on the different servers then you need to create the linkedserver
look for more information on Book online unders sp_addlinkedserver

Chirag
Go to Top of Page

marcuscoker
Starting Member

13 Posts

Posted - 2006-09-13 : 08:54:08
Many thanks
Go to Top of Page
   

- Advertisement -