GoTo Looping

Looping over a set of records is a very common operation conducted in applications, integrations, data warehouse, reporting, and more. It is generally advised to avoid looping in SQL if possible, as other programming languages can be much more efficient. Alas, there are times looping in SQL either unavoidable or the best option given a myriad of factors. There are various options for looping. The following list contains some of these options.

WHILE loop Recursive CTE CURSOR Nested stored procedures GoTo looping

This article will focus on the last bullet above that will be referred to as « GoTo Looping ».