Quantcast
Channel: Fórum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15680

How to iterate through multiple linked server to fetch the data for simple SQL query

$
0
0

Hi ALl,

I am writing a linked server query in the destination server to fetch data from multiple linked server in the below kind of scenario:

SQL query:

select * from FACT_SALES
where fulldate is not null

The above query I need to run for lets say 5 linked server.

In all 5 linked server the same database name is existing i.e.

Linkedserver1\\FACT_DATABASE\\FACT_SALES

Linkedserver2\\FACT_DATABASE\\FACT_SALES

Linkedserver3\\FACT_DATABASE\\FACT_SALES

Linkedserver4\\FACT_DATABASE\\FACT_SALES

Linkedserver5\\FACT_DATABASE\\FACT_SALES

Now, I need to fetch some info from the above 5 linked servers and load some temporary table with that information in the destination server.

Please let me know what is the best way to achieve this ?

Thanks


Viewing all articles
Browse latest Browse all 15680

Trending Articles



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