BaşlayınÜcretsiz Başlayın

Creating a WHILE loop

In this exercise, you will use the variable you created in the previous exercise you write a WHILE loop. Recall that structure:

WHILE some_condition 

BEGIN 
    -- Perform some operation here
END

Bu egzersiz

Intermediate SQL Server

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

Write a WHILE loop that increments counter by 1 until counter is less than 30.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

DECLARE @counter INT 
SET @counter = 20

-- Create a loop
___

-- Loop code starting point
___
	SELECT @counter = @counter + 1
-- Loop finish
___

-- Check the value of the variable
SELECT @counter
Kodu Düzenle ve Çalıştır