By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

Join tables from different databases?

P: n/a
Is it possible to join tables from different databases? If so, what is the
format of the select statement? Both databases are on the same server.
TIA,
--
Terry
Jul 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Terry,

A lot of answers on your question here,

http://groups.google.com/group/micro...rent+databases

Cor,

"Terry" <Te***@nospam.nospamschreef in bericht
news:05**********************************@microsof t.com...
Is it possible to join tables from different databases? If so, what is
the
format of the select statement? Both databases are on the same server.
TIA,
--
Terry

Jul 6 '07 #2

P: n/a
Hi Terry -

The format is this:

[databasename].[object owner name (usally dbo)].[tablename]

use database1
select * from database2.dbo.mytable

Two things to note:

Cross-database queries (especially if you're combining results or
doing cross-database joins) are S L O W, especially on tables with a
massive amount of data. You may want to revisit your approach.

Make sure that whatever user you're connecting to the database as has
access to both databases.

Happy Coding,

-Mark

Jul 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.