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 Oracle, http://www.withdata.com/ad/oracle/replace-update-or-insert-a-row-into-oracle-table-merge-into.html
In DB2, http://www.withdata.com/ad/db2/replace-update-or-insert-a-row-into-db2-table-merge-into.html
In PostgreSQL, http://www.withdata.com/ad/postgresql/replace-update-or-insert-a-row-into-postgresql-table.html
In Sqlite, http://www.withdata.com/ad/sqlite/replace-update-or-insert-a-row-into-sqlite-table.html