In this post explains how to use the BREAK statement in SQL Server (Transact-SQL) with syntax and examples.
In SQL Server, the BREAK statement is used when you want to exit from a WHILE LOOP and execute the next statements after the loop's END statement.
The syntax for the BREAK statement in SQL Server (Transact-SQL) is:
There are no parameters or arguments for the BREAK statement.
Let's look at an example that shows how to use the BREAK statement in SQL Server (Transact-SQL).
For example:
In this BREAK statement example, we will break out of the WHILE LOOP early, if @site_value is equal to 2.