What is the correct data type to store "Business Hours"
Do not store hours worked, keep minutes worked. Your values will become
Time int
---- ---
1:30 90
0:45 45
2:15 135
8:00 480
6:19 379
You will be able to convert it for display if necessary by dividing by 60 and taking the remainder.
Compression, on the other hand, will be very light.
source to share
SQL Server, unfortunately, doesn't have a data type that represents time slot 1 . I usually suggest a column int
and a bit of naming so that it clears it up in seconds / minutes / hours - no matter what granularity you want.
1 It has a data type time
but represents a time of day, not a time interval. It doesn't make sense to add twice a day together and it does, the datatype time
doesn't support adding.
source to share