You can use the DataTable.Compute method to execute the sums, however it will not know how to handle the duration like HH: MM, you will need to provide another colum in your SELECT, which converts HH: MM to a numeric type and then converts it back to HH: MM in your code after summing.
If you can change the database schema, I would save the duration as ticks in the int or bigint column. This makes it easy to convert to TimeSpan on the .NET side. It also allows you to more easily perform sum and range calculations in SQL. If you need to be able to convert TimeSpans to and from ticks into SQL, you can use the following functions that I wrote. I had to insert some random underscores (_) in order to get my response for sending. (For some reason, saving time without them.) They will need to be removed in order for the code to work. Excuse me.
To get ticks from a string representation of a time string:
CREATE FUNCTION [dbo].[ParseTimeSpanString] ( @timespan varchar(26) ) RETURNS INT AS BEGIN DECLARE @hourStart int DECLARE @minuteStart int DECLARE @secondStart int DECLARE @ticks bigint SET @hourStart = CHAR INDEX('.', @timeSpan) + 1 SET @minuteStart = CHAR INDEX(':', @timeSpan) + 1 SET @secondStart = CHAR INDEX(':', @timespan, @minuteStart) + 1 SET @ticks = 0 IF (@hourStart < @minuteStart) BEGIN SET @ticks = CON_VERT(int, LEFT(@timespan, @hourstart - 2)) * 864000000000 END ELSE BEGIN SET @hourStart = 1 END SET @ticks = @ticks + CON_VERT(int, SUBSTRING(@timespan, @hourStart, @minuteStart - @hourStart - 1)) * 36000000000 SET @ticks = @ticks + CON_VERT(int, SUBSTRING(@timespan, @minuteStart, @secondStart - @minuteStart - 1)) * 600000000 SET @ticks = @ticks + CON_VERT(decimal(9,7), SUBSTRING(@timespan, @secondStart, LEN(@timeSpan) - @secondStart)) * 10000000.0 RETURN @ticks END GO
To get a string representation of TimeSpan from ticks:
CREATE FUNCTION [dbo].[GetTimeSpanString] ( @ticks bigint ) RETURNS varchar(26) AS BEGIN DECL_ARE @timeSpanString varchar(26) IF @ticks < 0 BEGIN SET @timeSpanString = '-' END ELSE BEGIN SET @timeSpanString = '' END SET @ticks = ABS(@ticks) -- Days SET @timeSpanString = @timeSpanString + CON_VERT(varchar(26), FLOOR(@ticks / 864000000000.0)) + '.' SET @ticks = @ticks % 864000000000 -- Hours SET @timeSpanString = @timeSpanString + CON_VERT(varchar(26), FLOOR(@ticks / 36000000000.0)) + ':' SET @ticks = @ticks % 36000000000 -- Minutes SET @timeSpanString = @timeSpanString + CON_VERT(varchar(26), FLOOR(@ticks / 600000000.0)) + ':' SET @ticks = @ticks % 600000000 --Seconds DECLARE @seconds decimal(9,7) SET @seconds = @ticks / 10000000.0 SET @timeSpanString = @timeSpanString + CON_VERT(varchar(26), @seconds) RETURN @timeSpanString END GO