SQL Server для цикла
DECLARE @cnt INT = 0;
WHILE @cnt < cnt_total
BEGIN
{...statements...}
SET @cnt = @cnt + 1;
END;
Different Dunlin
DECLARE @cnt INT = 0;
WHILE @cnt < cnt_total
BEGIN
{...statements...}
SET @cnt = @cnt + 1;
END;
--There is no for-loop, only the while-loop:
DECLARE @i int = 0
WHILE @i < 20
BEGIN
SET @i = @i + 1
/* do some work */
END