Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
datepart for milliseconds not precise in SQL...
datepart for milliseconds not precise in SQL Server 2008?
Rate Topic
Display Mode
Topic Options
Author
Message
Erin Ramsay
Erin Ramsay
Posted Monday, March 14, 2011 3:51 PM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 11:03 AM
Points: 438,
Visits: 808
Why does this:
DATEPART(MILLISECOND,cast('2011-03-14 17:43:52.134' as datetime))
return 133?
and
DATEPART(MILLISECOND,cast('2011-03-14 17:43:52.135' as datetime))
return 137?
Is there an inconsistency in anything smaller than a second in SQL Server 2008?
Donalith
Post #1078032
Erin Ramsay
Erin Ramsay
Posted Monday, March 14, 2011 4:02 PM
SSC-Addicted
Group: General Forum Members
Last Login: Yesterday @ 11:03 AM
Points: 438,
Visits: 808
Nevermind.. I didn't realize that SQL Server only maintained a 3.33 precision on milliseconds..
case closed.. thanks
Donalith
Post #1078034
Jeff Moden
Jeff Moden
Posted Monday, March 14, 2011 4:30 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:01 PM
Points: 33,111,
Visits: 27,037
IIRC, the resolution of some of the new datetime function in 2k8 has a
much
better resolution.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #1078042
Evil Kraig F
Evil Kraig F
Posted Monday, March 14, 2011 4:43 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 5:35 PM
Points: 5,722,
Visits: 6,194
Use the TIME datatype instead of DATETIME for higher resolution on timings. It's accurate to 100 nanoseconds.
Edit: Left the window open in the background too long I see, I've just added some clarity to what Jeff already mentioned.
- Craig Farrell
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions
|
Forum Netiquette
For index/tuning help, follow these directions.
|
Tally Tables
Twitter: @AnyWayDBA
Post #1078050
Lynn Pettis
Lynn Pettis
Posted Monday, March 14, 2011 7:56 PM
SSC-Insane
Group: General Forum Members
Last Login: Yesterday @ 9:17 PM
Points: 21,832,
Visits: 27,855
Also the datetime2 and datetimeoffset data types as well in SQL Server 2008.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #1078086
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.