Applying query across Server.

  • Hi all,

    Suppose i want to perform operations on 2 different server. How would i do it. I am just curious to know it.

    Definitely over here i am not going to join the tables so what is the alternative to do it.

  • Same command, two different servers? I would look at a central management server.

  • Maybe you mean, that you want to execute a cross server query?

    You may add linked server. After that you may query remote table specifying 4 part name:

    select * from MyServer.MyDatabase.MyScheme.MyTable.

    You may also create a synonim like

    create synonym dbo.remoteTable for MyServer.MyDatabase.MyScheme.MyTable

    and after that refer to remote table in your queries just with it like:

    select * from dbo.remoteTable

    You may alse use OPENQUERY ( linked_server ,'query' )

    or OPENROWSET to establish connection and query remote table.


    I am really sorry for my poor gramma. And I hope that value of my answers will outweigh the harm for your eyes.
    Blog: http://somewheresomehow.ru[/url]
    Twitter: @SomewereSomehow

  • What do you mean by 'operations'?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Phil Parkin (8/10/2012)


    What do you mean by 'operations'?

    Over here operation can be just select,update or delete.

  • In case you mean how to execute Multiple Server Queries[/url] from SSMS then basically you need to create a server group and then register couple servers under it and then execute against the group not then individual server - right-click the group and select New Query.

    --Vadim R.

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

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