?
Solved

more granularity than getdate()

Posted on 2005-03-15
8
Medium Priority
?
387 Views
Last Modified: 2012-08-13
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
Comment
Question by:LuckyLucks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 21

Expert Comment

by:Kevin3NF
ID: 13546630
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
 

Author Comment

by:LuckyLucks
ID: 13546717
yes, something like 2005-03-15 11:59:12.770
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 800 total points
ID: 13547522
Yes, that will happen when you udpate or insert multiple rows.  They will all have the same value.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 1200 total points
ID: 13548183
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 13548410
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
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 13548479
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 13549773
>>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
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 13550167
>> 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question