I have a column called “WrkHrs” and the data type is time(hh:mm:ss). I want to sum up the working hours for employees. But since it’s time data type sql server doesn’t let me use like sum(columnname).
How can I sum up the time data type fieled in sql query?
You can format it pretty on the front end. Or in T-SQL:
However, you’re using the wrong data type.
TIMEis used to indicate a point in time, not an interval or duration. Wouldn’t it make sense to store their work hours in two distinct columns,StartTimeandEndTime?