Faced a trickly question and love to share here.
What is the precision of the GETDATE() and SYSDATETIME() functions?
General answer could be
GETDATE() function returns DATETIME data type so the precision is 3.33 ms,
SYSDATETIME() function returns DATETIME2 data type so the precision is 100 ns
Here is the difference we get which shows actually we may not use them when we need such high precision timekeeping. We could also notice that SYSDATETIME is more precise.
select getdate(), sysdatetime
2011-01-12 19:02:09.733
2011-01-12 19:02:09.7541380
Cheers,
RamaKrishna
Credits to Jacek Osuchowski.
No comments:
Post a Comment