block in Sql Server is same as GoTo
block in C#. It means it jumps to to defined block.In our code,if @rec_cnt variable value is greater than 0,then it jumps to the exit block.
and inside exit block,it will print value,We have to define GoTo keyword followed by name or label name and we have to give colon(:) in GoTo name block.
Declare @rec_cnt Int;
Select @rec_cnt = Count(*) From Employee_Master Where Employee_Id = 1;
If(@rec_cnt > 0) GoTo ExitBlock
You can give your own condition for GoTo Statement.