title: SQL Server - define target database name dynamically for MERGE statement
body: <p>I have 2 tables on 2 different databases on the same server with SQL Server 2012.
  I'm synchronizing those 2 tables using the MERGE statement but for the target table need to specify the database name dynamically in a query i.e [targetdb].[dbo].[tablename]</p>
  <p>I have prepared a query and use EXEC to execute the dynamic query, but Is it possible to use variable value for [targetdb] database</p>