Map Oracle, SQL Server, and Postgres Data Types
Any data warehousing operation crossing source systems is probably going to need to map data types across the source systems if they are all to land in the same platform.
Data Types Mapping
| Oracle | SQL Server | PostgreSQL |
|---|---|---|
| char | char | char |
| varchar | varchar | varchar |
| varchar2 | nvarchar | … |
| number | numeric | numeric |
| text | nvarchar(max)* | text |
| raw | binary | … |
| long raw | varbinary | bytea |
| rowid | integer** | … |
| date | date | … |
| timestamp | datetime2() | … |
| … | bit | boolean |
| … | smallmoney | money |
| … | uniqueidentifier | uuid |
| date | smalldatetime | timestamp |
| … | rowversion*** | bytea |
-
- MSSQL text is deprecated
- ** MSSQL integer stored as hexadecimal
- *** MSSQL timestamp is deprecated for rowversion
Further Reading:
Microsoft SQL Docs, Data Type Mapping for Oracle Publishers, Microsoft, dated 2020-07-03.
Ben Snaidero, Comparing SQL Server and Oracle Data Types, MSSQL Tips, Dated 2022-03-07.
EDB, PostgreSQL vs SQL Server (MSSQL): Extremely Detailed Comparison, EnterpriseDB, dated 2020-07-31.