Merge two Table in SQL Server 2008

后端 未结 1 1777
清酒与你
清酒与你 2021-01-18 20:28

I have 2 table one is a Stage table whose schema is exac to main,i want to update the data from stage table to main table with the ID column as refrential key. I have tried

相关标签:
1条回答
  • 2021-01-18 21:29

    You can refer to the merge source in the insert part, like:

    when not matched then insert
      (id, name, email_id) 
      values (stage.id, stage.name, stage.email_id)
    
    0 讨论(0)
提交回复
热议问题