SQL server to PostgreSQL data types mapping
Data Types Mapping for Migrating Microsoft SQL Server to PostgreSQL
or vice versa |
Microsoft SQL Server
and PostgreSQL have some similar data types while others are not. Before migration,
it is important to keep in mind the right types representing:
SQL Server
Data Types |
PostgreSQL
Data Types |
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 |