Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

DATETIME - 4 Expand / Collapse
Author
Message
Posted Monday, March 18, 2013 5:30 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 18, 2014 12:55 AM
Points: 386, Visits: 363
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.
Post #1432146
Posted Monday, March 18, 2013 5:31 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 8:37 AM
Points: 3,905, Visits: 5,079
Interesting question, thanks Ron

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1432148
Posted Monday, March 18, 2013 7:31 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, August 15, 2014 8:38 AM
Points: 3,668, Visits: 72,432
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

eventually it was a worthy read ,a simple query with calm mind ...
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
Post #1432190
Posted Monday, March 18, 2013 8:13 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 6:56 PM
Points: 21,620, Visits: 15,280
Nice question.



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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1432198
Posted Monday, March 18, 2013 8:27 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 8:48 AM
Points: 1,304, Visits: 1,672
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

Post #1432205
Posted Monday, March 18, 2013 8:32 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 6:24 PM
Points: 1,733, Visits: 1,205
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!
Post #1432206
Posted Monday, March 18, 2013 9:14 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 1:04 PM
Points: 1,364, Visits: 1,055
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.
Post #1432223
Posted Monday, March 18, 2013 9:37 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, November 13, 2013 1:13 PM
Points: 134, Visits: 101
Nice question, I learnt something new today
Post #1432233
Posted Monday, March 18, 2013 10:27 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 1:47 PM
Points: 3,292, Visits: 1,974
Nice question. I've hit that precision issue before so I guessed correctly. I like that 2012 datefromparts function too.
Post #1432257
Posted Monday, March 18, 2013 11:20 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 9:24 AM
Points: 4,422, Visits: 3,416
Nice one... Thanks, Ron!
Post #1432277
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse