I want to update record of a table through another database with equal columns

Asked

Viewed 25 times

0

I want to update the ordem_subclass column of the Prod_serv Table, and the reference are the codecolumns of the Prod_serv Table and code of the Subclass Table:

USE S9_Real
UPDATE Prod_Serv SET
Ordem_Subclasse = SC.ORDEM
FROM Prod_Serv PS
INNER JOIN S9_Real_MP2.DBO.Prod_Serv MP2PS ON PS.Codigo = MP2PS.Codigo
INNER JOIN S9_REAL_MP2.DBO.Subclasses MP2SC ON PS.Codigo = MP2PS.Codigo
INNER JOIN Subclasses SC ON SC.Codigo = MP2SC.Codigo
WHERE SC.Codigo = MP2SC.Codigo

  • what is the database? add a tag to help anyone who reads your question. at first you can make a link between the two databases

  • The Source database is S9_real_mp2 and Destination S9_real.

  • that’s not it, I mean if it’s sql-server, mysql, oracle etc.

  • Sorry, the database is sql-server 2012.

  • in this case you need to connect the servers through a link server, then you can select/update from one server to another, something like update campo=select campo from servidor.dbo.tabela

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.