You can get the difference between the two dates to whatever resolution you want (in your example, minutes):
DATEDIFF(minute, @start_date, @end_date)
From there it’s a simple matter of dividing minutes into hours and hours into days and modding the remainder.
More Related Contents:
- Retrieving last record in each group from database – SQL Server 2005/2008
- Base64 encoding in SQL Server 2005 T-SQL
- How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server?
- Isoweek in SQL Server 2005
- Aggregate SQL Function to grab only the first from each group
- Insert results of a stored procedure into a temporary table
- Check if table exists in SQL Server
- Does T-SQL have an aggregate function to concatenate strings? [duplicate]
- How important is the order of columns in indexes?
- Using the result of an expression (e.g. Function call) in a stored procedure parameter list?
- Convert Xml to Table SQL Server
- For Nvarchar(Max) I am only getting 4000 characters in TSQL?
- Is it possible to select sql server data using column ordinal position
- How to use alias column name in where clause in SQL Server
- How do I group on continuous ranges
- Dynamic SQL to generate column names?
- Is it possible to perform multiple updates with a single UPDATE SQL statement?
- Aggregate bitwise-OR in a subquery
- How to split string using delimiter char using T-SQL?
- How to find consecutive rows based on the value of a column?
- Can I use the MERGE statement in SQL Server 2005?
- SQL server select distinct rows using most recent value only
- What good are SQL Server schemas?
- Problem with Renaming a Column in SQL Server
- How to escape square brackets inside square brackets for field name
- Average of multiple columns
- SQL Server: How to permission schemas?
- Eliminate and reduce overlapping date ranges
- SQL Server: How to tell if a database is a system database?
- Memory effective way to read BLOB data in C#/SQL 2005