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!
For what you are proposing, you should use IF statements
While (@counter < 3 and @newBalance >0)
Begin
If @Counter = 1 Then
Begin
Set @monFee1 = @monthlyFee
Set @newBalance = @newBalance-@fee
End
If @Counter = 2 Then
Begin
Set @monFee2 = @monthlyFee
Set @newBalance = @newBalance-@fee
End
Set @counter = @counter +1
End
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With