|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
|
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, March 22, 2013 11:49 AM
Points: 945,
Visits: 998
|
|
Aha!
I have to say I enjoyed this more than the first article, largely because the first article was really just an introduction to the topic.
I like your use of examples where I can just see a developer writing that sort of code, usually because they don't know better.
I also like the introduction of a method for converting cursor statements into set-based equivalents. I think as you continue to walk through each of the parts of that method, it will make it easier for people new to thinking and working with sets to apply to their own code. Kudos for that.
For completeness, will you look at rewriting cursors into just using a loop (without the actual cursor, but otherwise identical)? Because that's another form of code that can also be replaced by set-based code.
I'm happy to give examples if you need them.
Well done!
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 7:39 AM
Points: 21,620,
Visits: 27,453
|
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 5:13 AM
Points: 32,906,
Visits: 26,793
|
|
Nicely done, Barry... I really like the way the story is unfolding in this series... very easy reading, as well. I absolutely agree that you have real life examples because I've seen the same thing not only on these fine forums, but in real production code, as well.
The bad part about this article is... I've finally learned how to write a Cursor and may have to burn out my mind's-eye to rid myself of the images of RBAR on steriods.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 23, 2013 8:00 AM
Points: 1,065,
Visits: 698
|
|
Well done! Can you tell us the publishing date of Part 3?
The results of the comparison: no spoilers here 
Original code: CpuMs: 8750 LogRds: 834261 Elapsed: 9898
Rewrite: CpuMs: 94 LogRds: 236 Elapsed: 89
Dutch Anti-RBAR League
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, March 14, 2013 4:15 AM
Points: 3,240,
Visits: 4,960
|
|
Another great Article.
Thanks...
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sometimes, winning is not an issue but trying. You can check my BLOG here
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
|
|
Thanks fro the support Folks! And Jeff, yeah, I had the same problem when writing these article.
As for part 3, unfortunately medical issues have kept me from completeing it, but I will let you know as soon as I do. In fact these same medical issues are going to keep me off-line most of today, however many of the heavy poster has offered to step-in to fkk the gaps and answer any thecnical questions
thanks again! ...
-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung Proactive Performance Solutions, Inc. "Performance is our middle name."
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, December 02, 2009 6:54 AM
Points: 7,
Visits: 31
|
|
| The fact you even have to tell so called developers this stuff is frightening.
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Today @ 6:46 AM
Points: 328,
Visits: 1,851
|
|
jwheeler (4/27/2009) The fact you even have to tell so called developers this stuff is frightening.
Not really and it's something I've seen a few times...
When someone has a background in VB or C and has been dumped into SQL development then they might be able to write code but they lack the set based thinking which a good DB developer needs (they might not even be aware of being able to return sets depending on how much exposure they're had to databases in their previous life).
Usually a helping hand with their first few pieces of work will get them thinking the right way from the outset. I know from experience when dabbling in ASP .NET that something which I've spent hours and several tens of lines of code trying to get to work can be ripped apart and rewritten as a very simple class by someone who knows what they're doing
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, December 02, 2009 6:54 AM
Points: 7,
Visits: 31
|
|
Samuel Vella (4/27/2009)
jwheeler (4/27/2009) The fact you even have to tell so called developers this stuff is frightening.Not really and it's something I've seen a few times... When someone has a background in VB or C and has been dumped into SQL development then they might be able to write code but they lack the set based thinking which a good DB developer needs (they might not even be aware of being able to return sets depending on how much exposure they're had to databases in their previous life). Usually a helping hand with their first few pieces of work will get them thinking the right way from the outset. I know from experience when dabbling in ASP .NET that something which I've spent hours and several tens of lines of code trying to get to work can be ripped apart and rewritten as a very simple class by someone who knows what they're doing
Then surely the manager hasn't done their job by employing the wrong tool for the task?
If you have database development to be done you either employ a db dev or a C# / VB developer who is also a SQL dev. You don't buy a hammer to put a screw in the wall, surely?
|
|
|
|