PostgreSQL Equivalents of Data Types in SQL Server

Hello everyone,

In this article, I will try to show the PostgreSQL equivalents of data types in SQL Server.

SQL Server and PostgreSQL have similar data types. Most are equal but some are not. When migrating from SQL Server to PostgreSQL, it is important to keep the correct type mapping in mind and use the table below.

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

Good luck to everyone in business and life.

94 Views

Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!