SQL Server Linked Database

I was using one database (DB1) and wished to refer to a table in another database on the same server (DB2).
This is accomplished without resorting to sp_addlinkedserver.

USE DB1
GO
SELECT TOP 20 * FROM DB2..TABLE1

Observe that there are two periods between DB2 and TABLE1. This is not a typo.


About this entry