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 ««1234»»»

Nanoseconds Expand / Collapse
Author
Message
Posted Thursday, November 8, 2012 3:04 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: Sunday, October 19, 2014 2:53 AM
Points: 3,133, Visits: 3,402
sqlnaive (11/8/2012)
This was a good question. I gave wrong answer or better to say incomplete answer (opted for only 4). Method 2 I was not sure because of code written was not complete.

from my perspective, losing 2 points is not a big deal than gaining small but important piece of knowledge.

+ 1

Still a good question though - maybe I took the supplied options a little bit too literaly


-------------------------------
Posting Data Etiquette - Jeff Moden
Smart way to ask a question

There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
Post #1382355
Posted Thursday, November 8, 2012 3:10 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 11:42 AM
Points: 13,295, Visits: 11,086
derek.colley (11/8/2012)
...

Of course, if this argument doesn't apply to DATETIME2 (rather than DATETIME) then I offer you a hearty apology and withdraw my comments.

Still a great QotD. Thank you.


It doesn't apply to DATETIME2, only to DATETIME
Apology accepted.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1382358
Posted Thursday, November 8, 2012 4:07 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 7,804, Visits: 9,556
My apologies to all for the incompleteness of option 2. Although I agree with "Arturius" though that it is pretty obvious what is missing and don't think it should have confused anyone, I'll ask Steve to correct it.

Tom
Post #1382386
Posted Thursday, November 8, 2012 4:13 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 7,804, Visits: 9,556
matthew.flower (11/8/2012)
While I haven't tried them (have work to do) I am not convinced that any of them "work reliably" when you consider changes to and from daylight savings.

In the UK at least daylight savings changes happen at either 1am which becomes 2am or 2am which becomes 1am, so 2am back to midnight can be 1 hour or 3 hours at least once a year.

Unless I am missing something none of these methods convert both midnight and the current time to UTC before doing the difference between them so I would argue that the correct answer is none of them.

You are absolutely correct. The wording needs to be changed to say "except on the days when daylight saving time begins or ends".


Tom
Post #1382397
Posted Thursday, November 8, 2012 4:34 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, August 1, 2013 10:17 AM
Points: 323, Visits: 984
Koen Verbeeck (11/8/2012)
sanket kokane (11/7/2012)
I got it wrong ...

you should mention sql server Version in question .

Sysdatetime () not present in sql 2000 and 2005


So, for which versions do you think the question is meant? Obviously for 2008 and up. There's also a consensus that versions who are no longer supported by Microsoft do not count for Questions of the Day.



ohhh sorry .. I still have Bunch of servers running on 2000


I will must say its nice question .
Got to learn something new


-----------------------------------------------------------------------------
संकेत कोकणे
Post #1382409
Posted Thursday, November 8, 2012 5:21 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Wednesday, February 20, 2013 1:45 AM
Points: 616, Visits: 97
Great Question
Post #1382431
Posted Thursday, November 8, 2012 5:22 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 7,804, Visits: 9,556
Koen Verbeeck (11/8/2012)
Nice question Tom, but I doubt if I'll ever use it

(ps: you must be getting old if you can't count to four anymore )


I am indeed getting old (although I can't seem to catch up with Ron), but I can still count four: zero, one, two, three . It's just that I sometimes forget to add one when I've counted something.


Tom
Post #1382433
Posted Thursday, November 8, 2012 6:06 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 12, 2014 4:19 AM
Points: 701, Visits: 1,145
This is absolutely the worse question I have encountered on QotD. Think I will pass on future Tom questions.
Post #1382445
Posted Thursday, November 8, 2012 7:30 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:04 PM
Points: 13,086, Visits: 12,553
(Bob Brown) (11/8/2012)
This is absolutely the worse question I have encountered on QotD. Think I will pass on future Tom questions.


If this is the worst QotD you have encountered, I would encourage you to peruse more QotD.

Nice question Tom. I got tripped up by method 2 and answered only 4 but as always I learned something new.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1382495
Posted Thursday, November 8, 2012 7:48 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Tuesday, September 2, 2014 11:51 AM
Points: 1,452, Visits: 254
Good question, but I would question if a method is reliable if it does not work less than 1/3 of the time daily, method 2 overloaded at 8 am since this means that it would be only good during after midnight but only through early morning.
Post #1382504
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse