|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 12:56 PM
Points: 2,017,
Visits: 2,850
|
|
Nils Gustav Stråbø (12/9/2010)
I'd like the link that tells us we can't run the t-sql before answering. I can't remember ever seeing that post anywhere. That's cheating in my world 
I suppose it would be cheating if this was for something meaningful such as money, a job, or a degree. But to collect points for fun is not something I'd worry about cheating for.
The important thing is to learn something; whether you run the code first, last, or not all shouldn't matter (IMO ).
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:12 AM
Points: 6,370,
Visits: 8,235
|
|
kevin.l.williams (12/9/2010)
Nils Gustav Stråbø (12/9/2010)
64% got it right. Yeah, right!! How many cheated and ran the T-SQL code?
I cheated and got it right! By the way, how many of you read the forum comments and stop after you get to Hugo's? 
Isn't that the way this works here?
Wayne Microsoft Certified Master: SQL Server 2008 If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it! Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines, CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 9:52 AM
Points: 2,796,
Visits: 1,125
|
|
Hugo Kornelis (12/9/2010)
kevin.l.williams (12/9/2010)
By the way, how many of you read the forum comments and stop after you get to Hugo's?   If that number is significantly large, I'll have to consider postponing my comments, so that other valuable comments get read as well.  Thanks for the kind words!
HaHa, You will propbably never know the true number since my comment was after yours.
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Today @ 8:00 PM
Points: 1,850,
Visits: 985
|
|
Good Question.good discussions
Malleswarareddy I.T.Analyst MCITP(70-451)
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 5:11 PM
Points: 7,104,
Visits: 7,168
|
|
Nils Gustav Stråbø (12/9/2010) I don't like questions like this, and not because I got it wrong. It teaches me nothing about Sql Server or T-SQL (except debugging peculiar T-SQL), and to be able to answer it correctly, without cheating, you will have to manually write down how many rows are inserted in each run of the loop in order to keep track of the number in the meaningless "SomeNumberForDate" column.
No, you don't need to do that. You can see that 512 is greater than 365, so the last rows added have SomeNumberForDate = 256. Before that the last row added; and number of rows adsded before then was clearly 256 (it's all in poowers of two, obviously). There are 365 rows in all and and 256 with SomeNumberForDate 128 or less, and that leaves just 109 that have SomeNumberForDate = 256. All you have to see is that the number of rows added each time is a power of 2, that the number of rows in teh table after each set is added is a power of 2, that there are 365 days in the year 2010, and that 512 is the smallest power of two greater than 365. No manually writing down meaningless numbers required.
I guess that learning to thing mathematically is a bit like learning to think set-oriented: is you don't learn it you end up doing things the hard way.
If it had been a question designed to check people's ability to do simple maths, it would have been a good question; but as it was apparently meant to teach something about SQL, it didn't achieve its objective. But there's some good SQL in the comments, so it was at least a useful question.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, July 25, 2012 9:04 PM
Points: 542,
Visits: 187
|
|
| Too big code i just ran the code. but yeah i did learned bit about date and then got lost...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 19, 2011 1:59 AM
Points: 1,042,
Visits: 234
|
|
Good question followed by even better discussion.
Good learning for me.
Thanks Guys.
|
|
|
|