Select statement using multiple database connections

If you are talking about Microsoft SQL servers and if those SQL servers are able to “talk” to each other I’d be making a Linked server connection at the SQL server level on the first server.

Your query would then become:

SELECT s1.Column [S1 Col], s2.Column [S2 Col] --, etc... FROM server1.database.schema.table1 S1 {INNER|OUTER|LEFT|RIGHT} JOIN server2.database.schema.table2 S2 ON S1.someKeyCol=S2.someKeyCol WHERE someWhereClause...

We use these linked servers frequently across our WAN for reading data, for writing data I’d be keeping the tables on a single server instance (one less variable to consider :smiley: )

Oh, and make sure you have the TCPIP protocol enabled on the SQL servers (+the SQL Browser service enabled + appropriate firewall rules as applicable) - this is crucial for getting the linked server set up. You can do all of that using MSSMS (Microsoft SQL Server Management Studio) if you are a DB Admin. If not, get your DB Admin to set it up for you.