SQL code running against Server group names.

  • Hello all, Is it possible to assign a query to run against a particular group of server registrations?. Eg Instead of use [dbname] use [Registration name]

    I have a number of servers assigned into different registration groups and would find this useful.

    Has anyone come across, or used this feature?.


    Kindest Regards,

    Nick

  • I am not aware of this being available to you within SSMS. However, you could certainly write your own SSIS package that could loop through a server list to simulate the same thing via a For Each ADO Enumerator.

    This article describes that process pretty well.

    http://www.codeproject.com/KB/database/foreachadossis.aspx

  • You could save your script with SQLCMD variables and call it via xp_cmdshell.

    Greets

    Flo

  • From SSMS 2008 and above:

    1) Create a group in Registered Servers

    2) Register the servers into this group that you want to work with

    3) Right-click the group, select New Query

    4) Run your query

    Your query will run against all servers listed in the group.

    Is that what you are trying to do?

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Hi,

    Thanks for your replies. I already use the registration grouping feature to run queries against multiple servers. My query relates to running a command against a registration group Eg. Running a query against a group named "Finance" or "Production".

    Thanks.


    Kindest Regards,

    Nick

Viewing 5 posts - 1 through 4 (of 4 total)

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