July 30, 2002 at 8:12 am
am a junior level SQL developer, and would really
appreciate a quick advice on how to calculate the total of
time duration column in a table. The datatype for the time
duration is varchar and its format is 00:00:00. I would
like to write a stored proc which calculates the total for
all time durations, all the time durations are in one
column. I cannot convert the varchar to numeric directly,
and I can't use the aggregate function sum. Please help!!
The time duration is coming from a DTS package from an
external data source. I just need to either add this sp to
the DTS so each time the new time durations come in, the
sp runs and calculates the total duration where ID = x.
Please let me know if additional info is required.
A Quick Response is Appreciated Thanks
feel free to email me or post the message back.
My email address is aleemmansoor@hotmail.com
.
July 31, 2002 at 1:37 am
Try using the following function to calculate the duration (in seconds). timechar is the column holding the duration in the 'hh:mm:ss' format.
DATEDIFF(second, '00:00:00', timechar)
You can easily sum the result of that result.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply