# SQL query compare and replace

**URL:** <https://forum.inductiveautomation.com/t/sql-query-compare-and-replace/37379>\
**Category:** Ignition\
**Created:** [August 4, 2020, 6:13pm UTC](https://forum.inductiveautomation.com/t/sql-query-compare-and-replace/37379 "2020-08-04T18:13:50Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 5, 2020, 3:54pm UTC](https://forum.inductiveautomation.com/t/sql-query-compare-and-replace/37379/12 "2020-08-05T15:54:01Z")

</div>

@toddayers, Are you using SQL Server? If so, you would need to use MERGE. Sample statement here:

> [@SQL IF EXIST in a script](http://forum.inductiveautomation.com/t/sql-if-exist-in-a-script/10781/2):
>
> If you are using SQL Server, look into using merge. MERGE INTO table\_name WITH (HOLDLOCK) USING table\_name ON (condition) WHEN MATCHED THEN UPDATE SET column1 = value1 [, column2 = value2 …] WHEN NOT MATCHED THEN INSERT (column1 [, column2 …]) VALUES (value1 [, value2 …])

---

_[View the full topic](https://forum.inductiveautomation.com/t/sql-query-compare-and-replace/37379)._
