[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
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.