SQL Server Data Type 5 Quick Guide for Postgres User
1. The NVARCHAR
In postgres, we only have VARCHAR
The NVARCHAR
is unicode VARCHAR
it required twice storage
If you store somthing that might have some extra language or charactor always use NVARCHAR
2. Number
The Postgres have double precision
SQL Server have Real
and Float
where Real
is old school version of Float
The NUMERIC
= DECIMAL
is the same here as well as basic type like int
3. No JSON and ARRAY
There is some workaround to this issue to add some hook to preprocess and postprocess in and out database table
But I think it is much worse experience.
So basically no this type and avoid modelling in this type.
4. Never use Money
Just like Postgres offer the money type.
MONEY
SMALLMONEY
It doesn’t work for multiplication and division where some people argue that it is the user input fault i.e., why do you multiple / divide money with money type?
See the discussion here
So why we use something that is not universally accepted without any benefits?
We can stick to the classic
DECIMAL
that everyone knows without any problems.
5. Datetime2
The timestamptz
and timestamp
will turns to Datetime2
Yes, with 2
you read it right.