Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

more granularity than getdate()

Hi EEE<
 Is there a function on the SQL server that provides more granularity than the getdate(). I am finding that at times the getdate() creates 2 same timestamps.
Thanx
0
LuckyLucks
Asked:
LuckyLucks
2 Solutions
 
Kevin3NFCommented:
you are getting two identical timestamps all the way down to the millisecond?  Wow...

I am not aware of anything more granular.....perhaps another Expert is...
0
 
LuckyLucksAuthor Commented:
yes, something like 2005-03-15 11:59:12.770
0
 
Anthony PerkinsCommented:
Yes, that will happen when you udpate or insert multiple rows.  They will all have the same value.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Scott PletcherSenior DBACommented:
No, AFAIK, Windows cannot provide anything more granular then 3 (not 1) milliseconds, so neither can SQL Server.  Therefore, if you need uniqueness, you will also need to use an identity column or something similar.
0
 
Anthony PerkinsCommented:
Scott,

>>No, AFAIK, Windows cannot provide anything more granular then 3 (not 1) milliseconds<<
I know this is beside the point, but should that not be 18 ticks per second or approximately 55 milliseconds?
0
 
Scott PletcherSenior DBACommented:
I know that SQL is only accurate to within 3ms.  This can be confirmed from BOL and simple tests.

What I read -- I think it was from the "Inside SQL Server" books, but not 100% sure now -- indicated that was because Windows itself cannot handle time with accuracy below 3ms.  The cause of that, you're right, had something to do with cycles and clock ticks, but I don't remember all those details.  [Please forgive me, I'm a software guy *not* a hardware guy.]
0
 
Anthony PerkinsCommented:
>>I know that SQL is only accurate to within 3ms.<<
Right, BOL confirms this:
<quote>
Date and time data from January 1, 1753 through December 31, 9999, to an accuracy of one three-hundredth of a second (equivalent to 3.33 milliseconds or 0.00333 seconds)
</quote>
I just don't understand how that is possible if Windows itself cannot handle a resolution finer than 55 milliseconds.

>>[Please forgive me, I'm a software guy *not* a hardware guy.]<<
Same here that is why I though I would ask you. <g>

Thanks all the same.
0
 
Scott PletcherSenior DBACommented:
>> I just don't understand how that is possible if Windows itself cannot handle a resolution finer than 55 milliseconds. <<

As *I* understand it, Windows can now also handle down to 3ms, but I could easily be mistaken.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now