I have this statement
EXEC [spProject_Update] @ProjectID = 496
,@Name = 'Hangman Bollywood iPhone'
,@Description = ''
,@EstimateTime = 2674800000
I will get milliseconds in @EstimateTime
.
How can I convert this to datetime
in SQL Server?
sql serversql-server-2008
I have this statement
EXEC [spProject_Update] @ProjectID = 496
,@Name = 'Hangman Bollywood iPhone'
,@Description = ''
,@EstimateTime = 2674800000
I will get milliseconds in @EstimateTime
.
How can I convert this to datetime
in SQL Server?
Best Answer
DATETIME
is used to store an instant ("point in time") at a particular granularity (approx 300 milliseconds IIRC).The value you wish to store is an interval (or is it a duration?) in milliseconds. SQL Server lacks an interval data type.
While both are temporal data they have quite different requirements. I suggest you use an numeric column (e.g.
INTEGER
) to store the interval and use metadata (e.g. an appropriate name) to convey the fact the granularity is one millisecond.