Hi,
I've got me a database where the developers included a total hours column as a varchar format. Specifically it's of the form: hours colon minutes e.g. 8:30
I need to add up these hours and so after a lot of messing around a searching this forum I found this method:
SUM(Datediff(hh,0,CONVERT(DATETIME,totalnoofhours,114)))
However I've now found some values for totalnoofhours of 24:00
or 26:30 etc. In these cases I get an out-of-range datetime error when I try to sum the hours.
Short of changing the format of the data (which I am trying to sort out through the supplier) can anyone suggest any short term solutions.
Kind regards
Andy
I've got me a database where the developers included a total hours column as a varchar format. Specifically it's of the form: hours colon minutes e.g. 8:30
I need to add up these hours and so after a lot of messing around a searching this forum I found this method:
SUM(Datediff(hh,0,CONVERT(DATETIME,totalnoofhours,114)))
However I've now found some values for totalnoofhours of 24:00
or 26:30 etc. In these cases I get an out-of-range datetime error when I try to sum the hours.
Short of changing the format of the data (which I am trying to sort out through the supplier) can anyone suggest any short term solutions.
Kind regards
Andy