I am attempting to figure out a SQL script and am unclear how nested IF statements behave. An example of what I am trying to figure out is shown below. Assuming that the 1st IF statement is true (A='22222'), does the last IF statement (IF D = 'ORTGNV') get evaluated regardless of the answer to the second IF statement (IF B='12345' and C='98765')? I've also attached a word copy of the script in case indentation is messed up.
IF A = ‘22222’
BEGIN
DO AAA
IF B = ‘12345’ and C = ‘98765’
BEGIN
DO BBB
END
ELSE
BEGIN
DO CCC
END
IF D = ‘ORTGNV’
BEGIN
DO DDD
END
END SQL-Script-Nested-IF.docx