Is it True that can't join tables from different servers?
Options
https://stackoverflow.com/questions/32272091/joining-two-tables-from-different-servers-using-linq
According to this, it's not possible. If it is, what is the syntax? I have a connection that used additional linked servers but don't know how to differentiate primary connection and additional one when it is a different server
According to this, it's not possible. If it is, what is the syntax? I have a connection that used additional linked servers but don't know how to differentiate primary connection and additional one when it is a different server
from p in TableInPrimaryServer
join r in TableInSecondaryServer.RM00101s on p.PHONE equals r.PHONE1
Comments
-
If you're using LINQPad's automatic data context, and have the developer or premium edition, you can query across SQL Servers that have been linked:
http://www.linqpad.net/FAQ.aspx#cross-database
Here's how to link SQL Servers:
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql -
Thanks, I have linked servers but I can't find the LINQ syntax to access the secondary table on a different server, tried
join r in TableInSecondaryServer.RM00101s on p.PHONE equals r.PHONE1
-
After following the instructions in the FAQ, you should end up with a data context in LINQPad that includes tables from both databases. If you are unsure on how to refer to one of these tables, simply drag it onto the editor.
-
Redid my connections and click and drag, works now. Thanks!