Introduction

In a single transaction (MERGE Statement) we can perform Insert, Update and Delete records on a existing table based on the result comparison between important columns with another table. Which also means we no longer needs to write multiple T-SQL statements to handle Insert, Update, Delete.

MERGE Statements

To perform MERGE, we need two tables as,

  • Source Table – This table holds the changes that needs to applied to the target table.
  • Target Table – The table that requires changes, that is in this table we will perform Insert, Update and Delete.

#sql server #sql #sql query #ssms

MERGE Statement in SQL Server to Insert, Update, Delete Records
1.20 GEEK