Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

While/Loop Help Expand / Collapse
Author
Message
Posted Thursday, February 7, 2013 2:38 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: 2 days ago @ 11:49 PM
Points: 4,973, Visits: 11,660
johmga26ssn (2/7/2013)
I have just read more closely ... I had thought the board was 2 dimensional. Yes, you just need a println() once you have printed the array: it doesn't depend on the value of k as I said.


Reported as spam.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1417363
Posted Thursday, February 7, 2013 6:32 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 6:03 PM
Points: 3,609, Visits: 5,221
wafw1971 (2/6/2013)
Hi Phil

Thanks for you replies, the calendar template option will be something I will use in the future but I would like to learn about loops.

Wayne


Better 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 7, 2013 6:42 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:59 PM
Points: 23,000, Visits: 31,482
dwain.c (2/7/2013)
wafw1971 (2/6/2013)
Hi Phil

Thanks for you replies, the calendar template option will be something I will use in the future but I would like to learn about loops.

Wayne


Better advice is learn to avoid them.


Better advice, yes, but hard to follow if the boss says you must use them.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1417421
Posted Friday, February 8, 2013 2:27 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 4:12 PM
Points: 958, Visits: 1,031
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; -- if
end; -- while

Post #1417910
Posted Monday, February 11, 2013 12:56 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 18, 2014 9:09 AM
Points: 870, Visits: 2,385
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; -- if
end; -- while





_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #1418235
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse