Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by sknox
»
New Year's Math
16 posts, Page 2 of 2
««
1
2
New Year's Math
Rate Topic
Display Mode
Topic Options
Author
Message
Sean Lange
Sean Lange
Posted Thursday, January 03, 2013 8:54 AM
SSCrazy Eights
Group: General Forum Members
Last Login: 2 days ago @ 8:46 AM
Points: 8,547,
Visits: 8,204
Good topic for a question. However since I always try to get the answer without running the code I tend to really dislike questions with this level of nested logic. I am horrible at being a sql engine but pretty decent at deciphering code. I was unable to keep focus long enough to decipher the overly complicated query. I think you could have presented the idea with a far less complicated query.
That being said the explanation was good and it is always good to have a refresher on how these functions work. Thanks for the question.
_______________________________________________________________
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
Post #1402421
mtassin
mtassin
Posted Thursday, January 03, 2013 9:09 AM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 5:03 PM
Points: 3,226,
Visits: 64,087
I solved it like Toreador, but at the same time I found the explanation about the literals interesting.
thanks for the question!
--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 #1402430
Revenant
Revenant
Posted Thursday, January 03, 2013 9:52 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 11:46 AM
Points: 3,448,
Visits: 2,522
Interesting question -- I figured out the date math but had to find what that ODBC syntax was about. There is always something new or so far unexplored to learn. Thanks!
Post #1402459
L' Eomot Inversé
L' Eomot Inversé
Posted Thursday, January 03, 2013 6:15 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:57 PM
Points: 7,079,
Visits: 7,121
Nice question. I enjoyed it.
The "flying duck" code layout made it easy to check that the parentheses matched up, so could see easily that there was no syntax error unless it was caused by those strange literals. So I had to find out what those strange literals were before going any further. First I hit on
Date, Time, and Timestamp Literals
but the nasty typo on that page ("-type" for "literal-type") confused me so I looked further and found
Date, Time, and Timestamp Escape Sequences
which gave me what I needed (and showed clearly that my confusion with the earlier page was due to a typo) so now I knew there wasn't a syntax error.
So then I could follow a process much like what some others have mentioned. Since a lot of things were added, all integer multiples of one second and none of them zero, the miliseconds in the result had to be the same as in the starting point (non-zero) and the resulting datetime had to be greater than the starting point - so only one of the options fitted the bill. No need to do any arithmetic - but it made me think!
Tom
Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
Post #1402629
Koen Verbeeck
Koen Verbeeck
Posted Friday, January 04, 2013 1:31 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 1:01 PM
Points: 9,367,
Visits: 6,463
Very interesting question. But a lot of reading
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 #1402742
asifkareem
asifkareem
Posted Tuesday, January 15, 2013 12:24 PM
SSChasing Mays
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 8:34 AM
Points: 606,
Visits: 134
Easy One!
Post #1407420
« Prev Topic
|
Next Topic »
16 posts, Page 2 of 2
««
1
2
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.