2216 Unexpected end of the SQL script

Advantage Error Guide

Problem: The SQL script cannot be parsed correctly because the expected block ending token was not found.

Solution: Make sure the script is written correctly. Verify that all control statements, such as IF, WHILE, and TRY statements, have corresponding END [xxx] tokens to denote the end of the control statement.