sql - How to Jump back to the loop increment stage inside a stored procedure if a condition is satisfied inside the loop? -
i have stored procedure shown below has loop running inside it. if condition mentioned below satisfied need go loop , start loop stage. how can achieve this?
..... steps......... while (@iv<= @rcnt) begin create table #mathlogictable ( idnum integer identity(1,1), attributename varchar(256), inputvalues decimal(15,3) ) insert #mathlogictable select statements.................. if (not exists (select 1 #mathlogictable)) begin set @iv=@iv+1 (i need step go start of loop...if condition satisfies) end ------------------------------------------------------------ select............ update........ n steps......... ------------------------------------------------------------- end
you should use continue
keyword:
if (not exists (select 1 #mathlogictable)) begin set @iv=@iv+1 continue end
Comments
Post a Comment