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

SQL Server to PostgreSQL Types Mapping

[SQL Server to Postgres Converter]  [About Migration]  [How to Control Migration Results

MS SQL and PostgreSQL have similar data types. Most of them are equal while others are not. When running SQL Server to Postgres migration it is important to keep in mind the correct types mapping:

SQL Server PostgreSQL
BIGINT BIGINT
BINARY(n) BYTEA
BIT BOOLEAN
CHAR(n), CHARACTER(n) CHAR(n), CHARACTER(n)
DATE DATE
DATETIME TIMESTAMP(3)
DATETIME2(p) TIMESTAMP(p)
DATETIMEOFFSET(p) TIMESTAMP(p) WITH TIME ZONE
DECIMAL(p,s), DEC(p,s) DECIMAL(p,s), DEC(p,s)
DOUBLE PRECISION DOUBLE PRECISION
FLOAT(p) FLOAT(p)
IMAGE BYTEA
INT, INTEGER INT, INTEGER
MONEY MONEY
NCHAR(n) CHAR(n)
NTEXT TEXT
NUMERIC(p,s) NUMERIC(p,s)
NVARCHAR(n) VARCHAR(n)
NVARCHAR(max) TEXT
REAL REAL
ROWVERSION BYTEA
SMALLDATETIME TIMESTAMP(0)
SMALLINT SMALLINT
SMALLMONEY MONEY
TEXT TEXT
TIME(p) TIME(p)
TIMESTAMP BYTEA
TINYINT SMALLINT
UNIQUEIDENTIFIER UUID or CHAR(16)
VARBINARY(n), VARBINARY(max) BYTEA
VARCHAR(n) VARCHAR(n)
VARCHAR(max) TEXT
XML XML

Integer types having IDENTITY property must be converted into Postgres SERIAL, BIGINT IDENTITY - into BIGSERIAL.

Spatial data (geometry and geography types) is migrated via well-known text (WKT) format.