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.
More Related Contents:
- How do you effectively model inheritance in a database?
- How does SQLParameter prevent SQL Injection?
- Like Operator in Entity Framework?
- Why did a network-related or instance-specific error occur while establishing a connection to SQL Server?
- How can I solve a connection pool problem between ASP.NET and SQL Server?
- Login failed for user ‘DOMAIN\MACHINENAME$’
- How to find foreign key dependencies in SQL Server?
- Update primary key value using entity framework
- A connection was successfully established with the server, but then an error occurred during the pre-login handshake
- What’s the best method to pass parameters to SQLCommand?
- What’s a good way to trim all whitespace characters from a string in T-SQL without UDF and without CLR?
- SqlDateTime.MinValue != DateTime.MinValue, why?
- Using “GO” within a transaction
- How to solve “unable to switch the encoding” error when inserting XML into SQL Server
- CLR Strict Security on SQL Server 2017
- How to build RUNAS /NETONLY functionality into a (C#/.NET/WinForms) program?
- Procedure expects parameter which was not supplied
- Does End Using close an open SQL Connection
- Does this code prevent SQL injection?
- TSQL md5 hash different to C# .NET md5
- How do I write LINQ’s .Skip(1000).Take(100) in pure SQL?
- Can you round a .NET TimeSpan object?
- How can you name the Dataset’s Tables you return in a stored proc?
- How to I serialize a large graph of .NET object into a SQL Server BLOB without creating a large buffer?
- Unable to load DLL ‘SqlServerSpatial.dll’
- .NET, the SqlConnection object, and multi-threading
- Implementing transactions over multiple databases
- SQL Connection Error: System.Data.SqlClient.SqlException (0x80131904)
- Using a variable for table name in ‘From’ clause in SQL Server 2008
- How to serialize a large graph of .NET objects into a SQL Server BLOB without creating a large buffer?