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

 While/Loop Help Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, February 07, 2013 2:38 PM
 SSCarpal Tunnel Group: General Forum Members Last Login: Today @ 2:10 AM Points: 4,762, Visits: 11,005
Post #1417363
 Posted Thursday, February 07, 2013 6:32 PM
 Hall of Fame Group: General Forum Members Last Login: Today @ 5:34 AM Points: 3,539, Visits: 4,976
 wafw1971 (2/6/2013)Hi PhilThanks for you replies, the calendar template option will be something I will use in the future but I would like to learn about loops.WayneBetter advice is learn to avoid them. My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!My thought question: Have you ever been told that your query runs too fast?My advice:INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.Need to UNPIVOT? Why not CROSS APPLY VALUES instead?Since random numbers are too important to be left to chance, let's generate some!Learn to understand recursive CTEs by example.Splitting strings based on patterns can be fast!
Post #1417420
 Posted Thursday, February 07, 2013 6:42 PM
 SSC-Insane Group: General Forum Members Last Login: Yesterday @ 7:37 PM Points: 22,261, Visits: 29,647
 dwain.c (2/7/2013)wafw1971 (2/6/2013)Hi PhilThanks for you replies, the calendar template option will be something I will use in the future but I would like to learn about loops.WayneBetter advice is learn to avoid them.Better advice, yes, but hard to follow if the boss says you must use them.
Post #1417421
 Posted Friday, February 08, 2013 2:27 PM
 SSC Eights! Group: General Forum Members Last Login: Sunday, March 09, 2014 8:46 PM Points: 957, Visits: 1,026
 Lynn Pettis (2/7/2013)Better advice, yes, but hard to follow if the boss says you must use them.`declare @success bit;exec CurriculumVitae_prepare;while (1=1) begin exec Job_Apply @isWhileRequired = 0, @isApplicationSuccessful = @success output; if (@success = 1) begin exec Interview_Attend @isInterviewSuccessful = @success output; if (@success = 1) begin exec Job_Accept @isJobAccepted = 1; exec Resignation_Give @timePeriod = 'immediate'; break; end; -- if end; -- ifend; -- while`
Post #1417910
 Posted Monday, February 11, 2013 12:56 AM
 SSC Eights! Group: General Forum Members Last Login: Monday, January 20, 2014 3:32 AM Points: 854, Visits: 2,297
 Bruce W Cassidy (2/8/2013)Lynn Pettis (2/7/2013)Better advice, yes, but hard to follow if the boss says you must use them.`declare @success bit;exec CurriculumVitae_prepare;while (1=1) begin exec Job_Apply @isWhileRequired = 0, @isApplicationSuccessful = @success output; if (@success = 1) begin exec Interview_Attend @isInterviewSuccessful = @success output; if (@success = 1) begin exec Job_Accept @isJobAccepted = 1; exec Resignation_Give @timePeriod = 'immediate'; break; end; -- if end; -- ifend; -- while` _________________________________________________________________________SSC Guide to Posting and Best Practices
Post #1418235

 Permissions