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

Synchronization

PostgreSQL to SQL Server converter implements synchronization as inserting data that not exists in the destination table and updating MS SQL rows with the related PostgreSQL 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, 
        FisrtName Varchar(50),
        LastName Varchar(50), 
        EMail Varchar(50), 
        Primary Key (ID)
    );

This table has the following contents in PostgreSQL database:

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

In SQL Server database:

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

After synchronizing MS SQL with PostgreSQL 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.