title: No column name was specified for column 1 of 'src' Merge statement SQL server
body: <p>I am using the MERGE statement in SQL server to refresh the data but I am repeatedly getting this error int the ON clause of the MERGE statement.
  The code is </p>
  
  <pre><code>    DECLARE @instance varchar(50)
      DECLARE @db varchar (50)
      DECLARE @queryEntity nvarchar(max)
  
      SET @instance = (select value from Parameter where name = 'SERVERALIAS')
      SET @db = (select value from Parameter where name = 'SERVERDB')
  
      SET @queryEntity = 'Select EntityId,EntityName,CreatedDate,ModifiedDate,Active,TENANTID,PriorityId From [' + @instance + '].[' + @db + '].metadata.Entity Where TENANTID = 1'
  
      MERGE [metadata].[Entity] AS trgt
      USING ( VALUES(@queryEntity) ) AS src
  
      ON ( **trgt.EntityId = src.EntityId** ) 
  
      WHEN matched 
      --AND trgt.ModifiedDate &lt;= src.ModifiedDate 
      THEN 
        -- if the master has a row newer than the client
        -- update the client                      
        UPDATE SET trgt.EntityId = src.EntityId, 
                   trgt.EntityName = src.EntityName, 
                   trgt.Createddate = src.CreatedDate, 
                   trgt.ModifiedDate = src.ModifiedDate, 
                   trgt.Active = src.Active, 
                   trgt.TENANTID = src.TENANTID, 
                   trgt.PriorityId = src.PriorityId      
  
      WHEN NOT matched BY SOURCE
      THEN 
        DELETE 
  
      WHEN NOT matched BY TARGET
      THEN 
        INSERT ( EntityId, EntityName, CreatedDate, ModifiedDate, Active, TENANTID, PriorityId) 
        VALUES ( src.EntityId, src.EntityName, src.CreatedDate, src.ModifiedDate, src.Active, src.TENANTID, src.PriorityId); 
  </code></pre>