How to Reference Multiple Databases on the Same Server
Creating a SELECT statement that references multiple databases on the same server in SQL Server is simple, but the syntax is not obvious and not well documented. Without the proper syntax, you will get the SQL message: “Invalid object name.” The correct syntax is as follows:
USE Database1
GO
SELECT *
FROM Database2.dbo.TableName
The only real trick is remembering to include the “dbo” in the correct spot. You will, of course, have to have permission to both databases.