Skip to content

SQL Server target

TwinCommit applies changes to SQL Server with set-based MERGE statements from a staged batch and writes the checkpoint in the same transaction. Character columns are created with a binary collation by default, so keys compare by code point exactly as they do in the source.

Supported: SQL Server 2016 and later (compatibility level 130+), Azure SQL Database and Managed Instance.

target:
type: sqlserver
dsn: sqlserver://twincommit:${MSSQL_PASSWORD}@mssqlhost:1433?database=Replica
collation: Latin1_General_100_BIN2 # default; "default" = database collation
CREATE USER twincommit FOR LOGIN twincommit;
ALTER ROLE db_ddladmin ADD MEMBER twincommit;
ALTER ROLE db_datareader ADD MEMBER twincommit;
ALTER ROLE db_datawriter ADD MEMBER twincommit;

Under SQL Server’s usual case-insensitive collations, two source keys that differ only in case would collide on one row. Keep the BIN2 default unless you know your keys do not depend on case. Set collation: default to use the database collation.