powershelldba.de · Uwe Janke
Version history

sqmMergeGenerator changelog

Every release, what changed, and why. Full detail and diffs on GitHub.

0.1.0.0

2026-10-02

Initial release

WinForms GUI Show-sqmMergeGeneratorGui: connect with Windows or SQL authentication, pick source and target database and table per combo box, three columns side by side (source columns, SSIS-style mapping source to target, key columns), options and the instantly regenerated statement below. Copy, save as .sql, syntax check with SET NOEXEC ON, execute after confirmation.

New-sqmMergeStatement generates without a database connection. Upsert / SCD type 1: update only on real change (NULL-safe via EXCEPT), optional delete of rows missing from the source, HOLDLOCK, OUTPUT $action, automatic IDENTITY_INSERT. SCD type 2: change type per column (history, overwrite, fixed), valid from/to and current flag, open end NULL or a fixed date, closing of missing keys. Implemented as MERGE ... OUTPUT INTO #temp plus INSERT in one transaction instead of composable DML, so dimensions with triggers and foreign keys work; returns a summary row. Duplicate key check before the MERGE (THROW 50001), source filter, casts for xml/text/ntext/image and CLR types.

Metadata through System.Data.SqlClient, no dbatools dependency. Live test with 36 checks passed on SQL Server 2022 under Windows PowerShell 5.1 and PowerShell 7.