r/programming • u/squareproton • Nov 16 '14
PostgreSQL vs. MS SQL Server - A comparison of two relational databases from the point of view of a data analyst
http://www.pg-versus-ms.com/
171
Upvotes
r/programming • u/squareproton • Nov 16 '14
19
u/squareproton Nov 17 '14
No, it doesn't. That return value is a plain int, which you can't add to or subtract from a date. Yeah, you can use DATEADD; it quickly gets unreadable. A plain int is less human-readable than "03:51:21", which is what PostgreSQL returns if you ask it what 2014-01-04 14:53:21.000 - 2014-01-04 11:02:00.000 is (notice you can just do a subtraction instead of using a function).
MSDN says:
So, using your method, it just breaks if you want second precision over a gap greater than 68 years, or millisecond precision over 25 days. In PostgreSQL, it just works properly. Do this:
and you get this: