SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


DATETIME - 4


DATETIME - 4

Author
Message
db4breakfast
db4breakfast
SSC-Addicted
SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)SSC-Addicted (469 reputation)

Group: General Forum Members
Points: 469 Visits: 389
Thanks for the question. I learned this precision rounding from March 12, inner join question from Archie Flockhart's comment. :-)

--------------------------------------------------------------------------------------
Hai Ton
My Db4Breakfast blog.
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
SSCrazy Eights
SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)

Group: General Forum Members
Points: 8801 Visits: 7279
Interesting question, thanks Ron

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
mtassin
mtassin
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4796 Visits: 72518
demonfox (3/17/2013)
L' Eomot Inversé (3/16/2013)
Nice question, and fine explanation, but that bit about "59.005" seems to have come from a different than the rest. ;-)


+1

May be, because, it's monday it looked like too much english and a long script to read . Then, I finally decided to go on with the question .. In the end, I realised it is a question about datetime millisecond precision w00t

eventually it was a worthy read ,a simple query with calm mind ...:-P
thanks for the question

Edit: english


Same here... but apparently I didn't consume enough coffee before I tried to answer this one... gah my head hurts.



--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32006 Visits: 18551
Nice question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

sknox
sknox
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2590 Visits: 2828
I'm curious: What was the point of the cursor-like WHILE and incrementing the ID by 3? Just Obfuscation? Why didn't you just write the query as:


SELECT ID AS 'Select number', DATETIMEFROMPARTS ([Year],M,D,H,Mi,S,Ms) AS 'Datetime'
,CAST(S AS CHAR(2)) + ':' + CAST(Ms AS CHAR(3)) AS 'Original seconds input'
FROM #T


Primo Dang
Primo Dang
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1960 Visits: 1396
L' Eomot Inversé (3/16/2013)
Nice question, and fine explanation, but that bit about "59.005" seems to have come from a different than the rest. ;-)


I thought that part was weird too, made me think longer about the answer as though it was some kind of trick question, but then I decided to go with the answer that made more sense to me and got it right. =]

Thanks for yet another fine question, Ron!
Rose Bud
Rose Bud
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1615 Visits: 1062
sknox (3/18/2013)
I'm curious: What was the point of the cursor-like WHILE and incrementing the ID by 3? Just Obfuscation? Why didn't you just write the query as:


SELECT ID AS 'Select number', DATETIMEFROMPARTS ([Year],M,D,H,Mi,S,Ms) AS 'Datetime'
,CAST(S AS CHAR(2)) + ':' + CAST(Ms AS CHAR(3)) AS 'Original seconds input'
FROM #T



I have the same question as sknox, except I might add an "order by" to his proposed query.
SathishK
SathishK
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 111
Nice question, I learnt something new today
Ken Wymore
Ken Wymore
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5048 Visits: 2373
Nice question. I've hit that precision issue before so I guessed correctly. I like that 2012 datefromparts function too.
Revenant
Revenant
SSCertifiable
SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)

Group: General Forum Members
Points: 7306 Visits: 4859
Nice one... Thanks, Ron!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search