Convert SQL Server to PostgreSQL Convert SQL Server to PostgreSQL

Microsoft SQL Server Read a Microsoft SQL Server database, load it into PostgreSQL

Move Your SQL Server Data to PostgreSQL, Even From an Offline File

Univik opens your SQL Server (MSSQL) database file directly and writes each table to CSV that PostgreSQL pulls in with the COPY command. Because it reads the file and not a live connection, the move still works when the server is gone, the database is detached or the file is corrupt.

  • Offline Source: Open the MDF, NDF or BAK file with no SQL Server instance running.
  • COPY Ready CSV: Each table lands in a CSV built for a PostgreSQL COPY import.
  • Schema Script: A column and type list to rebuild the structure in Postgres.
  • Damaged Files: Pull rows from a corrupt or detached database that will not attach.

Univik SQL Server to PostgreSQL box

SQL Server file to PostgreSQL through CSV export Your source SQL Server file MDF, NDF or BAK Detached or offline Corrupt or a backup Univik exports CSV plus a schema script No SQL Server needed Your target PostgreSQL loaded with COPY

 Why Univik

Move SQL Server Data to PostgreSQL Without a Live Server

Every direct MSSQL to PostgreSQL tool needs a running database. Univik works from the file, so an offline, detached or missing server is not a blocker.

Reads the File, Not the Server

Univik works on the database file itself. The SQL Server instance can be shut down, uninstalled or long gone.

CSV That Postgres Loads

Each table is written to CSV that COPY, psql or pgAdmin reads as is, with no dialect edits.

Schema You Can Rebuild

The exported script spells out every column and type, giving you a blueprint for the Postgres schema.

Handles the Whole Database

A database split across a primary MDF and several NDF files is stitched together and exported in one run.

Works on Corrupt Sources

Page level parsing lifts tables from a suspect or damaged database that a connection based tool would reject.

Read Only and Safe

Univik only reads the source. The original database stays byte for byte the same, with no chance of data loss.

 The Motivation

Why Convert SQL Server to PostgreSQL

Teams move from SQL Server to PostgreSQL for open source freedom and a powerful feature set. Here is what Postgres brings.

Free to Run

PostgreSQL is open source, so there are no core or server license fees.

Advanced Features

JSON, full text search and window functions come built in for complex work.

Standards Compliant

Strong SQL standard support keeps your queries portable across systems.

Rich Data Types

Native UUID, JSON, arrays and XML hold your SQL Server data with less loss.

Cross Platform

Postgres runs on Linux, Windows and Mac, not just Windows Server.

Cloud Ready

Managed Postgres runs on AWS, Azure, Google Cloud and more.

 The Steps

How to Convert SQL Server to PostgreSQL

From a SQL Server file to a populated PostgreSQL database in four steps.

The four steps of a SQL Server to PostgreSQL conversion 1 Open the file MDF, NDF or BAK 2 Export to CSV plus a schema script 3 Create Postgres tables from the reference 4 Load the CSV with COPY
  1. Load the source file: Point Univik at the MDF, NDF or BAK. There is no attach and no instance to start.
  2. Export the tables: Send each table you pick to its own CSV, together with a schema script of columns and types.
  3. Create the PostgreSQL tables: Build the target tables from the exported script, converting each SQL Server type with the guide below.
  4. Load the data: Pull the CSV into PostgreSQL with the COPY command, psql or pgAdmin, then check the row counts line up.

 Reference

SQL Server to PostgreSQL Data Type Mapping

Use this guide when you create the PostgreSQL tables. It covers the types you meet most often.

SQL ServerPostgreSQL
intINTEGER
bigintBIGINT
smallintSMALLINT
tinyintSMALLINT
bitBOOLEAN
decimal / numericNUMERIC
moneyNUMERIC(19,4)
floatDOUBLE PRECISION
realREAL
datetime / datetime2TIMESTAMP
datetimeoffsetTIMESTAMPTZ
dateDATE
timeTIME
char / varcharCHAR / VARCHAR
nchar / nvarcharCHAR / VARCHAR
text / ntextTEXT
varbinary / imageBYTEA
uniqueidentifierUUID
xmlXML
What converts cleanly and what needs a rewrite From your SQL Server database Converts cleanly to PostgreSQL Tables Columns and rows of data Primary and foreign keys Indexes and data types Needs a manual rewrite Stored procedures Views Triggers Other T-SQL logic

Beyond Data Types

A SQL Server IDENTITY column becomes GENERATED AS IDENTITY or SERIAL in PostgreSQL, square brackets become double quotes and TOP becomes LIMIT.

Table structures and their rows follow the guide above. Procedures, views and triggers hold T-SQL that PostgreSQL will not run as is, so Univik exports them in the script as a reference while you port the logic to PL/pgSQL.

 Comparison

Univik vs Live Connection Tools

See how it compares to tools that pipe SQL Server to PostgreSQL over a live connection.

Univik

  • No Server Needed: Opens a detached, offline or corrupt file on its own.
  • COPY Ready: Output the PostgreSQL COPY command reads straight away.
  • Schema Script: Column and type detail for every table.
  • Multi File: Primary MDF and all NDF files together.
  • Non Destructive: The source stays read only.

Live Connection Tools

  • Needs a Live Server: The source instance must be online.
  • No Server No Move: A retired server stops the job.
  • Stops on Damage: A corrupt database halts the transfer.
  • Config First: ODBC drivers and connection strings up front.
  • Hits Production: Queries run on the live database.

 Data Sheet

Converter Specifications

Product details, source support and requirements.

Product Name:Univik SQL Server to PostgreSQL
Version:6.7 (Latest)
Source Files:SQL Server MDF (.mdf), NDF (.ndf) and BAK (.bak), detached, offline, corrupt or a backup.
Source Versions:SQL Server 2000 to 2025
Output:CSV for each table plus a SQL script that documents the schema.
Targets:PostgreSQL, through CSV and the COPY command.
Platforms:Windows 11 and 10 (64-bit), Windows Server 2016 and later.
Prerequisites:.NET Framework 4.8 or higher. No SQL Server or SSMS needed.
License Price:Starting from $99   Buy Now

 Help & Support

SQL Server to PostgreSQL Questions

Common questions about converting SQL Server to PostgreSQL.

Univik writes your SQL Server data to CSV that PostgreSQL pulls in with the COPY command, psql or pgAdmin. Univik never touches a PostgreSQL server, so the final load is yours to run. That file first design is what lets it convert while SQL Server sits offline, something a connection based tool cannot manage.

Yes. Univik works straight off the database file on disk, so no SQL Server, ATTACH or instance is involved. Send the tables to CSV, then bring them into PostgreSQL on any machine.

Univik hands you a SQL script that records each column and its SQL Server type. Build the PostgreSQL tables from it. Typical mappings are int to INTEGER, nvarchar to VARCHAR, datetime2 to TIMESTAMP, bit to BOOLEAN, uniqueidentifier to UUID and varbinary to BYTEA. The full guide sits in the data type mapping table above.

Yes. Page level reading lifts data out of detached, offline and corrupt databases that refuse to attach. For badly damaged files, repair them with Univik SQL Database Recovery first, then export to CSV.

Tables and their rows convert cleanly. Procedures, views and triggers hold T-SQL, which PostgreSQL will not run, so you port them to PL/pgSQL by hand. Univik still exports them in the script, giving you the original logic to work from.

Univik reads source databases across the SQL Server line from 2000 to 2025, covering 2005, 2008, 2008 R2, 2012, 2014, 2016, 2017, 2019 and 2022. It picks up the version and collation from the file on its own.

No. Univik opens the source read only and never writes back to it. Every output is a fresh CSV or script file you name, which keeps the conversion safe on production data.

Still have questions? Contact support or Live Chat

 Related Tools

Explore More Univik Tools

SQL Server Database Migration

SQL Server Database Migration

The full migration guide, from server moves and upgrades to other database engines.

Learn More
SQL Server to MySQL

SQL Server to MySQL

Move the same SQL Server data into MySQL or MariaDB through a CSV export.

Learn More
SQL Database Recovery

SQL Database Recovery

Repair a corrupt or suspect database before you export it to PostgreSQL.

Learn More