If you’ve ever needed to find the difference between two dates in SQL Server, you might have used the DATEDIFF()
function. This function returns the amount of time between two dates using a datepart specified by you. For example, you could use it to return the number of days between date 1 and date 2. You can also get it to return the number of minutes, seconds, months, years, etc.
The DATEDIFF_BIG()
function works exactly the same way, but with one subtle difference: Its return data type.
So the difference between these two functions is the data type of their return value.
DATEDIFF()
returns a signed integer (int)DATEDIFF_BIG()
returns a signed big integer (bigint)