Creating a stored procedure to work an average based on 2 samlldatetime values
Posted on 2008-10-09
I'm trying to create a stored procedure in sql that will show the average time in hours, minutes and seconds from the date and time a new record was created to the date and time the record was closed.
For example, lets say that 100 rows are being counted, each row has a created column (smalldatetime value) and a closed column (smalldatetime value). i need to work out what the average time in hours, minutes and seconds it took for all rows (in this case 100 rows) so that it would give an output of something like:
total 100 - average time 2 Hours, 15 minutes and 35 seconds