Running multiple scripts against multiple databases in sqlserver

  • Dear All,

    Can someone please advise me on this.

    1. How to run multiple scripts against multiple databases ?

    2. How to run single script against multiple databases ?

    3. How to run multiple scripts against group of servers ?

    Thanks in advance.

    Thanks and Regards.

    Ravi.

  • 1. How to run multiple scripts against multiple databases ?

    2. How to run single script against multiple databases ?

    sp_MsForEachDB is an option, though undocumented and sometimes unreliable. A cursor is another option. Powershell/batch is another.

    3. How to run multiple scripts against group of servers ?

    You can create a server group in SSMS, right click it and select "New query". The statements in that query window will run against all the servers in the group.

    If you want assistance to set up any of these, just ask and I'll be glad to help.

    -- Gianluca Sartori

  • As Gianluca Sartori told create centralized server and add the servers as you want then run a script.

    Muthukkumaran Kaliyamoorthy
    https://www.sqlserverblogforum.com/

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

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