Equivalent of time(7) SQL Server 2008 datatype in .NET
10,943
Solution 1
Got a nice article from this link.
I will use timespan datatype in dot net as equivalent for time(7) datatype in SQL server to store hours and minutes.
Solution 2
MSDN gives a mapping between SQL data types and CLR data types - and it suggests TimeSpan
and Nullable<TimeSpan>
(for nullable columns) too. Note that how you access the data will determine how you actually get the value out though. DbDataReader
doesn't have a GetTimeSpan
method for example - but SqlDataReader
does have such a method. I'd expect LINQ to SQL or Entity Framework to perform the mapping automatically.
Related videos on Youtube
Author by
banupriya
Updated on June 04, 2022Comments
-
banupriya almost 2 years
What is the equivalent of SQL Server 2008's
time(7)
datatype in .NET? I want to store hours and minutes alone in that column, for this which datatype should I use in SQL Server!