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)
 Reference a table

Author  Topic 

Els
Starting Member

2 Posts

Posted - 2002-04-02 : 12:10:43
Hello all,
I need some input on this question:
You want to reference two tables that reside in different databases on the same server. Example is: from the INVENTORY database you want to reference a table in the SALES database. How would I reference the table in the SALES database in a query. Many thanks

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2002-04-02 : 12:16:39
since the databases reside on the same server you can use a 3 part identifer to access the SALES database

the syntax is database.owner_name.object_name

so you would want SALES.dbo.PURCHASES


if they were on a completly different server you would have to do server.database.owner_name.object_name

Take a look in BOL under 'Using Identifiers as Object Names' for more details.


Go to Top of Page
   

- Advertisement -