Search code examples
sqlsql-server-2008sql-merge

SQL MERGE to remote (linked) server table


Is it possible to utilize the SQL MERGE function on a linked server's database table? The end goal is to synchronize the remote table with our local SQL server table. I’ve done some research online and couldn’t find any related information. If it is possible how would you setup the source and target statements?


Solution

  • To reiterate the comment by @Mikael Eriksson, yes, you can. The target of a MERGE cannot be remote, but the source of a MERGE can be remote. So, if you can run the MERGE statement from your server in FL, then it is quite possible. For example, you could run something like this on your remove server in FL:

    MERGE INTO "local FL table" USING "CT server"."database"."schema"."same table" ON ...