question

SA avatar image
SA asked

An interesting question about joining two databases

How can I join a data mart and Northwind to populate the fact table in the same data mart?

database
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Jason Cumberland avatar image
Jason Cumberland answered

If these databases are on the same server/instance you can do this using three part name syntax, see below.

select            
    D.*            
    ,N.*            
from            
    DataMart.dbo.TablefromDataMart D            
join            
    Northwind.dbo.Employees N            
on            
    D.KeyField = N.KeyField            
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.