Running Query on Multiple Database/Servers

  • Hi

    I have a database table that contains all the server details. I have a query and wanted to run against all servers available in the table.

    Sample Query:

    SELECT DISTINCT Col1, Col2 FROM dbo.Test

    Requirement

    1. Connect to one server

    2. Run the Query against all the user DB and save the results into a table.

    Please suggest a best way to from SQL server.

    Thanks

    Shuaib

  • Have a look at this, perhaps it will help.

    http://msdn.microsoft.com/en-us/library/ms188427(v=sql.105).aspx

  • Here is how you would do it using SSIS:

    Iterate Over Databases Using SSIS – Part 2[/url]

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply