From:       To:      
Home > Documentation > MS SQL to PostgreSQL

Synchronization for MS SQL and PostgreSQL

SQL Server to PostgreSQL converter implements synchronization as inserting data that not exists in the destination table and updating PostgreSQL rows with the related MS SQL data. For synchronization purpose source and destination tables must have identical structures and have primary key or unique index defined.

Assume both MS SQL and PostgreSQL databases have table "People" defined as below:

    Table1(
        ID Integer NOT NULL, 
        FName Varchar(50),
        LName Varchar(50), 
        EMail Varchar(50), 
        Primary Key (ID)
    );

This table has the following contents in SQL Server database:

2  Andrew  White a.white@corporation.com
3  Phil  Johnson p.johnson@gmail.com

In PostgreSQL database:

1  John  Smith j.smith@msn.com
2  Andew  White a.white@yahoo.com

After synchronizing PostgreSQL with MS SQL data the source table is kept untouched and the destination table is modified as follows:

1  John  Smith j.smith@msn.com
2  Andew  White a.white@corporation.com
3  Phil  Johnson p.johnson@gmail.com

If you're looking for bi-directional incremental synchronization between SQL Server and PostgreSQL, take a look at MSSQL-PostgreSQL Sync tool.