How to update fields by querie of databases of different servers?

0

Good day, I hope and you can help me. I have 2 databases that are located on different servers, my idea is to update some fields through a query, however they are on different servers, for example I have one base on a server termination 192 ... 120 and another I have it on 192 .... 135, is there any way to do something ?. Thanks.

    
asked by Ric_hc 07.08.2017 в 18:43
source

1 answer

1

With your clarification the first thing you need is to link the base through LinkServer to which you need to access remotely.

Then you add the necessary connection information to that server, where it will specify the name with which you will call that server.

Already with this you can make your queries between servers, you just have to specify the server of the table to which you need to access in the following way:

SELECT*
FROM [SERVIDOR].[BASE DE DATOS].[ESQUEMA].[TABLA]

For example:

SELECT*
FROM Servidor.MiDB.Dbo.MiTable

And if you need to consult with any table of a server with the others, as in a JOIN :

SELECT *
FROM MiTabla AS A
INNER JOIN Servidor.BaseDatos.Dbo.MiOtraTabla AS B
    ON (a.id = b.id)

I hope my answer has helped you, regards.

    
answered by 07.08.2017 / 19:30
source