Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Datediff question Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, November 22, 2007 9:56 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Wednesday, June 8, 2011 4:12 PM Points: 146, Visits: 120
 Comments posted to this topic are about the item Because time is not infinite ... above all in milliseconds :DHow to do?
Post #425128
 Posted Monday, November 26, 2007 5:00 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Monday, October 20, 2008 4:01 PM Points: 163, Visits: 53
 The explanation is a little lacking. The cause of the overflow error is the use of ms (millisecond)in the command. If another unit of time is used ie second, then no error will result. BOL actually state the maximum length of time. I will leave it to the reader to find this number. (Boy did I hate this statement at uni when I was studying mathematics!)
Post #425671
 Posted Monday, November 26, 2007 5:17 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Wednesday, June 8, 2011 4:12 PM Points: 146, Visits: 120
 declare @timems numericselect @timems =(cast(datediff (dd,getdate()-28,getdate()) as numeric)* 86400000)select @timems--86400000 msxday
Post #425677
 Posted Monday, November 26, 2007 12:54 PM
 SSC Eights! Group: General Forum Members Last Login: Friday, October 24, 2014 4:29 PM Points: 872, Visits: 954
 The following will work even for the ms (milli second) unit of time:select datediff (ms,getdate()-24,getdate())Explanation can be found at:http://technet.microsoft.com/en-us/library/ms189794.aspx
Post #425961
 Posted Tuesday, November 27, 2007 12:04 PM
 SSC-Addicted Group: General Forum Members Last Login: Saturday, August 1, 2015 10:34 AM Points: 443, Visits: 949
 Nothing worth "bragging" about. All I had to do was run that query in the Query Analyzer.And got the answer instantanewously, no delay at all.So, such trick questions buying "braging" rigths are just too easy.
Post #426548
 Posted Tuesday, November 27, 2007 2:24 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Wednesday, June 8, 2011 4:12 PM Points: 146, Visits: 120
 Practically all the questions are answered using a query analyzer and/or a google search, but this isn't the way to answer them ... we aren't at school :P
Post #426595
 Posted Tuesday, October 7, 2014 7:02 AM
 SSCrazy Eights Group: General Forum Members Last Login: Yesterday @ 6:45 AM Points: 8,328, Visits: 858
 Thanks for the question.
Post #1623356
 Posted Tuesday, October 7, 2014 7:03 AM
 SSCrazy Eights Group: General Forum Members Last Login: Yesterday @ 6:45 AM Points: 8,328, Visits: 858
 I agree with the other posts. The problem is the ms and this isn't really discussed in the answer.
Post #1623357

 Permissions