Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sunnymohan
Starting Member
1 Post |
Posted - 2009-12-13 : 13:10:53
|
| Can anyone please explain the following query?DECLARE @orderdate DATETIME = 'Jan 01, 2007'SELECT DATEDIFF(DD,0,@orderdate)%11;The result of this query is 9. Please explain how the above statement equates to 9. Thanks in advance. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-13 : 17:20:53
|
| The better question is why someone is doing that. The reason why the answer is 9 is that there 39081 days between 01/01/1900 and 01/01/2007.39801//11 = 3552 with a remainder of 9.JimEveryday I learn something that somebody else already knew |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-14 : 01:31:18
|
quote: Originally posted by sunnymohan Can anyone please explain the following query?DECLARE @orderdate DATETIME = 'Jan 01, 2007'SELECT DATEDIFF(DD,0,@orderdate)%11;The result of this query is 9. Please explain how the above statement equates to 9. Thanks in advance.
What are you trying to do with this?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|