Can I have a CASE statement within a WHILE loop?
- by John
This is what I'm doing:
while (@counter < 3 and @newBalance >0)
begin
CASE
when @counter = 1 then ( @monFee1 = @monthlyFee, @newBalance = @newBalance-@fee)
when @counter = 2 then ( @monFee2 = @monthlyFee, @newBalance = @newBalance-@fee)
END
@counter = @counter +1
end
I get this error:
Incorrect syntax near the keyword 'CASE'.
No idea why. Please help!