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
Post a Comment