Reputation: 33
Why in SQL Server if I do this:
SELECT CONVERT(datetime, '2020-06-23 23:21:22.302', 121)
I get this date:
2020-06-23 23:21:22.303
Upvotes: 0
Views: 46
Reputation: 807
Try this:
SELECT convert(datetime, '2020-06-23 23:21:22.302', 121)
SELECT convert(datetime2, '2020-06-23 23:21:22.302', 121)
SELECT convert(datetime2(3), '2020-06-23 23:21:22.302', 121)
Upvotes: 2
Reputation: 311
Its because datetime in SQL Server is only accurate to 3ms and will round to increments of of .000, .003, or .007 seconds
Upvotes: 5