See DATEDIFF_BIG (Transact-SQL) for a function that handles larger differences between the startdate and enddate values. See Date and Time Data Types and Functions (Transact-SQL) for an overview of all Transact-SQL date and time data types and functions....
This article comes to us from Peter Larsson also known as Peso in the forums. He writes "I have seen many questions about the DATEDIFF function where people are baffled about why it doesn't calculate the correct result. The short answer is 'It does'." Peter discusses the DATEDIFF function...
If the start and end dates are equal or fall within the same interval, the function returns zero.SSIS Expression ExamplesThis example calculates the number of days between two date literals. If the date is in "mm/dd/yyyy" format, the function returns 7....
Applies to: SQL Server 2016 (13.x) and later Azure SQL Database Azure SQL Managed InstanceThis function returns the count (as a signed big integer value) of the specified datepart boundaries crossed between the specified startdate and enddate.See...