Linking Two Databases in a SQL Query

I have two databases, each on a separate machine in a network. I want to generate a report extracting data from table1 in database1 and table2 in database2.

How do I link the two databases in my SQL query?

First you have to identify the servers to each other as linked servers. Then you have to create logins for each server onto its linked server. They will recognize each other. Use fully qualified names to retrieve the respective tables.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: