Search code examples
sql-serverpostgresqlmigration

Is there any possible way to convert PostgreSQL database to MS SQL Server?


I am using Postgres db. I need to migrate this database to Microsoft SQL Server database. Is there any possible way?


Solution

  • Use this command:

    pg_dump -U username your_db_name > db_backup.sql --column-inserts
    

    The --column-inserts option generates INSERT statements possible for each row of data and should be compatible, but you may have to change the syntax just a little bit. (And it may cause data-loss, https://www.postgresql.org/docs/current/app-pgdump.html)

    Then just simply open the .sql file and run it inside SqlServer