Skip to content

Commit 24dad4c

Browse files
20250908 move sample
1 parent c098cd4 commit 24dad4c

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

docs/t-sql/statements/merge-transact-sql.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ This article provides different syntax, arguments, remarks, permissions, and exa
4141
4242
::: moniker-end
4343

44-
> [!TIP]
45-
> The conditional behavior described for the `MERGE` statement works best when the two tables have a complex mixture of matching characteristics. For example, inserting a row if it doesn't exist, or updating a row if it matches. When simply updating one table based on the rows of another table, improve the performance and scalability with `INSERT`, `UPDATE`, and `DELETE` statements. For example:
46-
47-
```sql
48-
INSERT tbl_A (col, col2)
49-
SELECT col, col2
50-
FROM tbl_B
51-
WHERE NOT EXISTS (SELECT col FROM tbl_A A2 WHERE A2.col = tbl_B.col);
52-
```
53-
5444
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
5545

5646
## Syntax
@@ -320,10 +310,20 @@ Specifies the search conditions to specify `<merge_search_condition>` or `<claus
320310
#### \<graph search pattern>
321311

322312
Specifies the graph match pattern. For more information about the arguments for this clause, see [MATCH (Transact-SQL)](../queries/match-sql-graph.md).
313+
323314
::: moniker-end
324315

325316
## Remarks
326317

318+
The conditional behavior described for the `MERGE` statement works best when the two tables have a complex mixture of matching characteristics. For example, inserting a row if it doesn't exist, or updating a row if it matches. When simply updating one table based on the rows of another table, improve the performance and scalability with `INSERT`, `UPDATE`, and `DELETE` statements. For example:
319+
320+
```sql
321+
INSERT tbl_A (col, col2)
322+
SELECT col, col2
323+
FROM tbl_B
324+
WHERE NOT EXISTS (SELECT col FROM tbl_A A2 WHERE A2.col = tbl_B.col);
325+
```
326+
327327
At least one of the three `MATCHED` clauses must be specified, but they can be specified in any order. A variable can't be updated more than once in the same `MATCHED` clause.
328328

329329
Any insert, update, or delete action specified on the target table by the `MERGE` statement are limited by any constraints defined on it, including any cascading referential integrity constraints. If `IGNORE_DUP_KEY` is `ON` for any unique indexes on the target table, `MERGE` ignores this setting.

0 commit comments

Comments
 (0)