• The example you provided is great. One comment though- the same goal can be achieved without any development efforts by running simple SQL queries on all databases and servers in parallel and returning aggregated results from all queried databases, by using tools such as SQL Farm Combine.

    The SQL-DMO code is good, however it runs serially and it can take quite some time for results to return, especially if you extend the example to return larger result sets, or retrieve data from a large number of databases and servers.

    Editor's Note: : Dr. Omri Bahat works for SQLFarms, a software vendor of SQL Server tools.