Updated on 2024-09-26 GMT+08:00

Microsoft SQL Server->PostgreSQL

Data Type (Microsoft SQL Server)

Data Type (PostgreSQL)

Whether to Support Mapping

TINYINT

INT2

Yes

SMALLINT

INT2

Yes

INT

INT4

Yes

BIGINT

INT8

Yes

DECIMAL

NUMERIC

Yes

NUMERIC

NUMERIC

Yes

FLOAT

FLOAT8

Yes

REAL

FLOAT4

Yes. The precision of SQL Server is 7 digits, while that of PostgreSQL is 6 digits. If the REAL value of the source database has 7 digits, 1-digit precision loss will occur when the value is synchronized to the destination database.

SMALLMONEY

NUMERIC (10,4)

Yes. The currency symbol will be lost.

MONEY

NUMERIC (19,4)

Yes. The currency symbol will be lost.

BIT

BOOL

Yes

DATE

DATE

Yes

SMALLDATETIME

TIME(0)

Yes

DATETIME2

TIME(6)

Yes. The precision may be lost.

DATETIME

TIME (3)

Yes

DATETIMEOFFSET

TIMESTAMPTZ(6)

Partially supported.

TIME(p)

TIME(p)

Yes. The maximum precision of PostgreSQL is 6.

XML

TEXT

Yes

CHAR[(M)]

CHAR

Yes

VARCHAR(M)

VARCHAR/ TEXT

Yes. Data is converted into the corresponding type based on the defined character length. If the defined character length is a specific number, the converted data type is VARCHAR. If the defined character length is max, the converted data type is TEXT. SQL Server supports a maximum of 4 GB, and PostgreSQL supports only 2 GB.

BINARY[(M)]

BYTEA

Yes

VARBINARY(M)

BYTEA

Yes

IMAGE

BYTEA

Yes

NTEXT

TEXT

Yes. SQL Server supports a maximum of 4 GB, and PostgreSQL supports only 2 GB.

TEXT

TEXT

Yes. SQL Server supports a maximum of 4 GB, and PostgreSQL supports only 2 GB.

NCHAR

CHAR

Yes

NVARCHAR(M)

VARCHAR/ TEXT

Yes. Data is converted into the corresponding type based on the defined character length. If the defined character length is a specific number, the converted data type is VARCHAR. If the defined character length is max, the converted data type is TEXT. SQL Server supports a maximum of 4 GB, and PostgreSQL supports only 2 GB.

UNIQUEIDENTIFIER

VARCHAR(36)

Yes

TIMESTAMP

BYTEA (8)

Yes