• The code is not working -- gives the following error

    Msg 102, Level 15, State 1, Line 44

    Incorrect syntax near 'end'.