Converting DateDiff to HH:MM:SS

Here is an example using backupset.

If I understood what you were asking for this should be it. It outputs the data as datatype TIME.

If you want datetime then replace CAST('00:00:00' AS TIME)) with '1/1/1900'.

 

SELECT database_name, DATEADD(ss,datediff(ss,backup_start_date, backup_finish_date),
CAST('00:00:00' AS TIME))
FROM backupset
GROUP BY database_name

 

http://www.sqlservercentral.com/Forums/Topic1379947-391-1.aspx

 

你可能感兴趣的:(datediff)