Posted By

icebob on 08/17/11


Tagged

sql insert mssql update upsert


Versions (?)

Mssql update or insert


 / Published in: SQL
 

  1. UPDATE MyTable SET FieldA=@FieldA WHERE KEY=@KEY
  2.  
  3. IF @@ROWCOUNT = 0
  4. INSERT INTO MyTable (FieldA) VALUES (@FieldA)

Report this snippet  

You need to login to post a comment.