In MySQL, we use “ON DUPLICATE KEY UPDATE” to either updates or inserts a row in a table.
How to do it in SQL Server?
Just like this:
if not exists (select 1 from employees where employee_id = 1)
insert into employees (employee_id,last_name,first_name) values ( 1,'smith', 'bob' )
else
update employees set last_name='smith' , first_name='bob' where employee_id = 1
See also:
Upsert data from CSV to SQL Server
Upsert data from TSV to SQL Server
Upsert data from TXT to SQL Server
Upsert data from Excel to SQL Server
Upsert data from XML to SQL Server
Upsert data from JSON to SQL Server
Upsert data from SQL file to SQL Server
Replace (Update/Insert) a row into other DB:
In DB2, https://www.withdata.com/blog/db2/replace-update-or-insert-a-row-into-db2-table-merge-into.html
In PostgreSQL, https://www.withdata.com/blog/postgresql/replace-update-or-insert-a-row-into-postgresql-table.html
In Sqlite, https://www.withdata.com/blog/sqlite/replace-update-or-insert-a-row-into-sqlite-table.html
Convert your data online, free
Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.