sql server - SQL datediff with negative parameter -



sql server - SQL datediff with negative parameter -

i finish noob sql , trying understand why query returns "115":

select datediff(yy, -3, getdate())

datediff takes 3 parameter. first interval, sec start date , 3rd end date. passing -3 start date, there can show:

select cast(-3 datetime) -- results in '1899-12-29 00:00:00.000'

and because 2014 - 1899 115, result.

sql sql-server date

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -