Answers for "how to insert if row does not exist (upsert) in sql server"

SQL
1

sql upsert

update table1 
set name = 'val2', itemname = 'val3', itemcatName = 'val4', itemQty = 'val5'
where id = 'val1'
if @@ROWCOUNT = 0
insert into table1(id, name, itemname, itemcatName, itemQty)
values('val1', 'val2', 'val3', 'val4', 'val5')
Posted by: Guest on June-17-2020

Code answers related to "how to insert if row does not exist (upsert) in sql server"

Code answers related to "SQL"

Browse Popular Code Answers by Language