Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9080

Re: query that spans servers/DB

$
0
0

Hi Stephanie,

 

You can use SQL's OPENDATASOURCE function:

 

SELECT *

FROM OPENDATASOURCE('SQLOLEDB','Data Source=YourServerNameHere;User ID=DatabaseUser;Password=SomePassword').[YourDataBaseNameHere].[dbo].[YourTableNameHere]

 

However, this method is not the best for intensive queries. If you are planning to use this in a large query, or query that will return large amounts of data then I suggest you look at Gordon's answer and use a linked server.

 

Regards,

Johan


Viewing all articles
Browse latest Browse all 9080

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>