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

Fun(?) with DATETIME2 Expand / Collapse
Author
Message
Posted Monday, December 27, 2010 5:19 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, June 23, 2014 7:30 AM
Points: 317, Visits: 153
gserdijn 2010-12-27
Hmm, undoubtedly this Q will come once again. But for a different country... like Holland.
(Which should be The Netherlands by the way, but I digress)

This is also my addition to this question. I am living in Czech Republic (formerly Czech Lands) and there was Gregorian Calendar adopted 'several' years before - It was in 1584 ... days between 6th January and 17th January 1584 was 'canceled'.


__________________________________
Standing on the shoulders of giants ...
Post #1039373
Posted Monday, December 27, 2010 5:53 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Friday, July 25, 2014 8:39 AM
Points: 115, Visits: 745
I agree with cdiebolt. While there was no such date in England's dating system at the time, it's a perfectly valid date in the Gregorian calendar, and corresponds to various dates in various countries' national systems.

So the function DOES do what I expected, hence it runs perfectly. "Perfect" is in the of the beholder, so not a word to be used in a specification - unless itself specified for the occasion. Please make the possible answers unambiguous in future - and scope the conditions precisely too.

I wonder if anyone has created a nation-sensitive historic date system in which Date('1752-09-02') + 1 would give the correct result depending on country. e.g. '1752-09-13' in England (and I think the rest of the UK), and '1752-09-03' in The Netherlands? It would be hard to do; you couldn't use ISO country codes to indicate locale, as some no longer exist and others (e.g. Belgium) were parts of multiple other countries at the time.
Post #1039379
Posted Monday, December 27, 2010 6:15 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, June 30, 2011 3:44 AM
Points: 971, Visits: 62
I did not know about the 1752, though I should have. I totally expected it to work after going over the BOL entry on datetime2. It is the first time, that I do not mind getting an answer wrong, cause I learned something new & useful. Thx for the excellent question.
Post #1039388
Posted Monday, December 27, 2010 6:50 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, May 9, 2014 12:47 AM
Points: 3,448, Visits: 4,407
I wonder how many records in one's database containing year 1752
Post #1039397
Posted Monday, December 27, 2010 6:59 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 24, 2014 7:11 AM
Points: 2,382, Visits: 177
I didn't expect it to fail so how can you say I did?
Post #1039400
Posted Monday, December 27, 2010 8:27 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 7,133, Visits: 6,295
Interesting. I didn't know the Gregorian calendar adoption for the British Empire was in 1752. All the history I studied talked about the Gregorian calendar being created in the 1500's, so I just assumed adoption was across the board in the same time frame.

Brandie Tarvin, MCITP Database Administrator

Webpage: http://www.BrandieTarvin.net
LiveJournal Blog: http://brandietarvin.livejournal.com/
On LinkedIn!, Google+, and Twitter.

Freelance Writer: Shadowrun
Latchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Post #1039431
Posted Monday, December 27, 2010 8:36 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Friday, July 25, 2014 8:39 AM
Points: 115, Visits: 745
BTW Microsoft's documentation has an error too - it says "Accuracy 100 nanoseconds". This is of course the Resolution (or Precision) of the data.

The accuracy will depend on the original source of the time-stamp - which in my experience can vary from minutes (old server nobody cares about) to milliseconds (typical NTP setup). You'll only get 100 nSec accuracy in systems very tightly coupled to GPS (or a satellite-coordinated atomic clock). Even then, by the time some code has decided to date an event many many μSecs will have passed.
Post #1039440
Posted Monday, December 27, 2010 9:26 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Tuesday, December 3, 2013 10:54 AM
Points: 197, Visits: 65
Fired up my local SQL 2008 Mgmt Studio, put the code into the query window (on Master), hit F5, and got: 1752-09-09 00:00:00.0000000


So, why do I now have an X on my test answer? I wasn't wrong, my SQL install isn't wrong... the world is.... :)

Oh well,
Phil
Post #1039466
Posted Monday, December 27, 2010 10:10 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Today @ 1:28 PM
Points: 21,329, Visits: 15,003
Total guess on this question. The question asks for opinions and the answer is an opinion. Based on that, I see more than one possible answer.



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 #1039484
Posted Monday, December 27, 2010 11:00 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 11:04 AM
Points: 814, Visits: 1,364
I guessed Option:1.

SSMS QA says: 1752-09-09 00:00:00.0000000

Not sure, why the correct answer is :: Option No: 3


Thanks.
Post #1039510
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse