This Video Tutorial illustrates how to use SMO enumerator to loop through linked servers.
SMO stands for SQL Server Management Objects, and using SMO provides ability to loop through list of metadata objects of SQL Server database or instance. This enumerator can be used for looping through jobs, linked servers, data files of database, and many other metadata structures of SQL Server instance.
In this video you will see an example of using SMO in real-world scenarios;
In this example there are two database servers for customer information; South Island, and North Island. In the destination server a linked server created for any of those servers. with SMO enumerator we will loop through all linked server (even linked server that are not exists now, but might be added in the future), and we fetch customer information from each linked server with a dynamic select command, and we load that into the destination integrated database. This scenario can be used with linked server to other databases such as Oracle, MySQL, DB2...