BREAK Statement:
You may want to terminate while loop by using the BREAK statement. You can use it as follows.
1 2 3 4 5 6 7 8 | DECLARE @testvariable int=1 WHILE(@testvariable<10) BEGIN IF(@testvariable=5) BREAK; Select @testvariable SET @testvariable+=1; END |

Continue Statement:
Usually used with the Break Statement. It is used to restart While Loop. You can use it as follows.
1 2 3 4 5 6 7 8 9 10 | DECLARE @testvariable int=1 WHILE(@testvariable<10) BEGIN Select @testvariable SET @testvariable+=1; IF(@testvariable=11) BREAK; ELSE CONTINUE; END |

![]()
Database Tutorials MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux 