I'd like to save the duration of a game. Something like 1:43:00
or 0:32:12
.
What data type should I choose if I'm using Microsoft SQL Server 2008 R2?
Use an integer type, and just store a quantity for the smallest unit of precision you care about (in this case, seconds). Your client program code should worry about formatting it. So for your two sample values, the stored data would be 6180
and 1932
.
To show the values, C# (for example) would use something like TimeSpan.FromSeconds().ToString()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With