title: Merge on multiple columns
body: <p>I'm attempting to insert records from a linked server using merge. The table only has two columns which both need to be used in order to check for new records. </p>
  
  <pre><code>MERGE dbo.[TableA] AS Target
  USING (SELECT [PERMNUM], [ABS_DATE]
      FROM [Linked Server].[dbo].[TableA]) 
              AS source ([PERMNUM], [ABS_DATE]
      ON (Target.[PERMNUM] = source.[PERMNUM] 
          AND Target.[ABS_DATE] = source.[ABS_DATE])
      WHEN NOT MATCHED THEN
          INSERT ([PERMNUM], [ABS_DATE])
          VALUES (source.[PERMNUM], source.[ABS_DATE]);
  </code></pre>
  
  <p>I'm getting the following error.</p>
  
  <pre><code>Msg 156, Level 15, State 1, Line 6
  Incorrect syntax near the keyword 'ON'.
  </code></pre>
  
  <p>How can I use both columns in the ON clause?  I've looked at other examples and as far as I can tell I have it correct.  </p>