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?
We can use DATEPART() function to get the MILLISECOND part of the DateTime in Sql Server, here we need to specify datepart parameter of the DATEPART function as millisecond or mi .
The GETUTCDATE() function returns the current database system UTC date and time, in a 'YYYY-MM-DD hh:mm:ss. mmm' format.
According to Microsoft SQL Server TechNet, latency is “the delay that occurs while data is processed or delivered.” In networking, latency is typically measured by how much time it takes for a data packet to get from one designated point to another.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With