Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


DateTime data types


DateTime data types

Author
Message
Pulivarthi Sasidhar
Pulivarthi Sasidhar
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1513 Visits: 1001
Comments posted to this topic are about the item DateTime data types
Danny Ocean
Danny Ocean
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1454 Visits: 1549
Thanks for start my day with an easy question.

Still i found result as "Correct answers: 100%"

Nice question, keep it up my friend !!!

:-)

Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
www.GrowWithSql.com
kapil_kk
kapil_kk
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: 2601 Visits: 2764
Really good question Smile
+1

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Primo Dang
Primo Dang
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1946 Visits: 1396
Got it right by elimination. There is no way a NULL value would be converted to an actual date (as far as I know, at least), so that eliminates answer B. Date types can't return an empty string (that would have to be char, varchar, etc.), so that eliminates answer A.

However, I never memorized the date that is equivalent to 0 and I didn't know if datetime, datetime2 and date had different conversions from integers, so if there had been an answer such as NULL, 1900-01-01 00:00:000, 1753-01-01 00:00:000, 1900-01-01, I might had gotten it wrong. Guess I learned that much from this question, then.

Thanks, Sasidhar Pulivarthi! :-D

Edit: changed "don't know if datetime (...) have different conversions from integers" to "didn't know", which made me realized I actually learned something new here. w00t
jlennartz
jlennartz
SSC Eights!
SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)

Group: General Forum Members
Points: 814 Visits: 1197
If default values are returned as in your explaination why are not all the values except null returned in this format, "1900-01-01 00:00:00.0000000". How did they get switched to "Jan 1 1900 12:00AM"?
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23197 Visits: 18271
Thanks



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


SQL RNNR

Posting Performance Based Questions - Gail Shaw

demonfox
demonfox
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1347 Visits: 1192
Primo Dang (4/11/2013)
Got it right by elimination
Thanks, Sasidhar Pulivarthi! :-D


+1

Thanks for the question ..

~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one Ermm
demonfox
demonfox
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1347 Visits: 1192
jlennartz (4/11/2013)
If default values are returned as in your explaination why are not all the values except null returned in this format, "1900-01-01 00:00:00.0000000". How did they get switched to "Jan 1 1900 12:00AM"?


the default conversion style for cast and convert is 0 for datetime and 121 for datetime2 ; that's how !!

ref: http://msdn.microsoft.com/en-gb/library/ms187928.aspx

~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one Ermm
manik_anu
manik_anu
SSC-Addicted
SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)SSC-Addicted (400 reputation)

Group: General Forum Members
Points: 400 Visits: 302
Primo Dang (4/11/2013)
Got it right by elimination. There is no way a NULL value would be converted to an actual date (as far as I know, at least), so that eliminates answer B. Date types can't return an empty string (that would have to be char, varchar, etc.), so that eliminates answer A.

However, I never memorized the date that is equivalent to 0 and I didn't know if datetime, datetime2 and date had different conversions from integers, so if there had been an answer such as NULL, 1900-01-01 00:00:000, 1753-01-01 00:00:000, 1900-01-01, I might had gotten it wrong. Guess I learned that much from this question, then.

Thanks, Sasidhar Pulivarthi! :-D

Edit: changed "don't know if datetime (...) have different conversions from integers" to "didn't know", which made me realized I actually learned something new here. w00t


i too memorize if we use datatime2 datatype that gives the datetime value as '1900-01-01 00:00:00.0000000 '. That is the reason to clicked the third answer... it's correct.....

thanks for this question.. nice one....

Manik
You cannot get to the top by sitting on your bottom.
jlennartz
jlennartz
SSC Eights!
SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)SSC Eights! (814 reputation)

Group: General Forum Members
Points: 814 Visits: 1197
demonfox (4/11/2013)
jlennartz (4/11/2013)
If default values are returned as in your explaination why are not all the values except null returned in this format, "1900-01-01 00:00:00.0000000". How did they get switched to "Jan 1 1900 12:00AM"?


the default conversion style for cast and convert is 0 for datetime and 121 for datetime2 ; that's how !!

ref: http://msdn.microsoft.com/en-gb/library/ms187928.aspx


Thank You
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