Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: (OT) T SQL Problem
by terce (Friar) on Sep 05, 2005 at 16:16 UTC
    You don't say what result you're expecting.

    However, I'd guess that you are expecting @A_counter to be redefined for each iteration of the outer loop. SQL variables aren't scoped like that, so you need to reset @A_counter to zero each time.
    You may find this does what you want:
    declare @B_counter int declare @A_counter int set @A_counter = 0 set @B_counter = 0 WHILE @B_counter <= 10 begin WHILE @A_counter <= 10 begin SET @A_counter = @A_counter + 1 print 'inner loop' end SET @B_counter = @B_counter + 1 SET @A_counter = 0 print 'outer loop' end
    On the other hand, you don't say what result you're after, or what you're getting, so I may be way off.
      or simpler and more consistent:
      declare @B_counter int declare @A_counter int set @B_counter = 0 WHILE @B_counter <= 10 begin set @A_counter = 0 WHILE @A_counter <= 10 begin SET @A_counter = @A_counter + 1 print 'inner loop' end SET @B_counter = @B_counter + 1 print 'outer loop' end
Re: (OT) T SQL Problem
by polettix (Vicar) on Sep 05, 2005 at 16:46 UTC
    This is extremely off-topic, as you may understand - better if you had to transfer your T-SQL knowledge over to Perl. Anyway, terce's efforts in answering would have been wasted without approval of your node, but please be more Perl-specific in the future.

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.