• david.gugg (3/4/2015)


    archie flockhart (3/4/2015)


    Curious as to why the Break doesn't exit from the IF , as the referenced BOL page suggests that it should ? ( It clearly does work as stated, just not sure what the BOL reference to the IF ...ELSE statement refers to ? )

    Exits the innermost loop in a WHILE statement or an IF…ELSE statement inside a WHILE loop. Any statements appearing after the END keyword, marking the end of the loop, are executed. BREAK is frequently, but not always, started by an IF test.

    I inferred the exact same thing from the MSDN site https://msdn.microsoft.com/en-us/library/ms181271.aspx. Why even mention the IF...ELSE statement if it's always going to exit the loop anyway?

    Good question.