I am trying to store a .Net TimeSpan
in SQL server 2008 R2.
EF Code First seems to be suggesting it should be stored as a Time(7)
in SQL.
However TimeSpan
in .Net can handle longer periods than 24 hours.
What is the best way to handle storing .Net TimeSpan
in SQL server?
I'd store it in the database as a BIGINT
and I'd store the number of ticks (eg. TimeSpan.Ticks property).
That way, if I wanted to get a TimeSpan object when I retrieve it, I could just do TimeSpan.FromTicks(value) which would be easy.