Reputation: 61
SELECT
CAST(‘2015-01-01 14:48:34.69’ AS DATETIME) FirstVal,
CAST(‘2015-01-01 14:48:34:69’ AS DATETIME) SecondVal
When we look at the answer, there is a difference between the milliseconds part in the result set, whereas you can notice that in the SELECT
statement I have specified different milliseconds part. The question is why there is a difference in the millisecond part even though I have different value selected?
Upvotes: 6
Views: 478
Reputation: 67
It's because you have selected different time is milliseconds.
Upvotes: 0
Reputation: 754963
DATETIME
has an accuracy of 3.33ms - you will never see a value with a .069
stored in a DATETIME
- you only ever get .xx0
, .xx3
and .xx7
.
If you need millisecond precision, use DATETIME2(3)
(introduced in SQL Server 2008) as your datatype instead.
Upvotes: 5
Reputation: 36
you have selected Diff Value in First Value:-34.69 and Second Value :- 34:69. you can see both value diff so out put diff.
Upvotes: 0