title: Using a tsql MERGE statement in SSIS to copy data between databases
body: <p>I am trying to do something which I think should be very straightforward, but I can't see how to actually do it.</p>
  
  <p>I have two databases which contain the same table with the same structure.</p>
  
  <p>I want to import the data from one database into the other, inserting new rows where they don't exist and updating rows that match on id. This needs to be done every evening.</p>
  
  <p>I am using SQL Server 2012.</p>
  
  <p>I think the best way would be to use an SSIS package with an 'execute sql task' that contains a tsql MERGE statement.</p>
  
  <p>I can't see how to actually do the two database connections the process would need.</p>
  
  <p>I have looked a lot at books on-line, and although it says it is possible, have found no examples.</p>
  
  <p>Any help would be really appreciated.</p>
  
  <p>Thanks.</p>