I have two SQL Server instances on two virtual machines, Test server and Production server.
I need to do an UPDATE to the production server taking data values from test server.
For example :
UPDATE [server_production].dbname.mytable
SET column1 = [server_test].dbname.mytable.column1
How do I do this ?
On your production server, define a Linked Server that points to your test server.
Then, on your production server you can run a query similar to the following to update your column:
In the above query, you’ll need to provide values for the placeholders:
<dbname>– the name of the prod/test database<schema>– the schema in which the table is defined (typically dbo)<TestLinkedServerName>– the name you’ve given to the linked server<id>– your PK column, or a column that uniquely identifies rows and provides a way to join the two tables