Select,Update,Delete,Insert etc.. in many server using 1 query

  • Comments posted to this topic are about the item Select,Update,Delete,Insert etc.. in many server using 1 query

    "-=Still Learning=-"

    Lester Policarpio

  • why not use replication ?

  • daniel 40017 (3/28/2012)


    why not use replication ?

    So how would you set up replication to send a one time query to my 50 linked servers? It must be a short efficient procedure since its a one off job.

  • The issue you presented regards an insert operation.

    a query is a different thing - one might think you are referring to distributed query on multiple servers for performance.

    an insert operation is generally not a one time operation and if you are adding records to a table and need to insert the same records to 50 other db's than I would use replication on that table and replicate it to all other servers. you have a built in module in sql server that does the work - why develop it yourself ?

  • daniel 40017 (3/28/2012)


    The issue you presented regards an insert operation.

    a query is a different thing - one might think you are referring to distributed query on multiple servers for performance.

    an insert operation is generally not a one time operation and if you are adding records to a table and need to insert the same records to 50 other db's than I would use replication on that table and replicate it to all other servers. you have a built in module in sql server that does the work - why develop it yourself ?

    I think it was a pretty handy little concept (I wasn't the original author), I'll probably play with his script a bit. It would be useful in my situation because I do have multiple servers, and while I may insert values into many tables on many servers, I wouldn't want the complete contents of tables replicated, and I'd also do select queries.

  • why not use POSH (Powershell) ?

    easy, convenient and efficient 😀

    ______________________________________________________________________________________________________________________________________________________________________________________
    HTH !
    Kin
    MCTS : 2005, 2008
    Active SQL Server Community Contributor 🙂

  • Or, if you have all the servers in a server group in SSMS, just open a multi-server query window in SSMS and run the query once against all the servers. http://shaunjstuart.com/archive/2011/09/teaching-an-old-dog-new-tricks/

  • shaun.stuart (3/28/2012)


    Or, if you have all the servers in a server group in SSMS, just open a multi-server query window in SSMS and run the query once against all the servers. http://shaunjstuart.com/archive/2011/09/teaching-an-old-dog-new-tricks/

    This was my first thought.:-)

  • Thanks for the script.

Viewing 9 posts - 1 through 8 (of 8 total)

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