Replace (Update/Insert) a row into SQL Server table

by

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

And 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

Some SQL Server tools you can try: https://www.withdata.com/sql-server/