/* while loop SQL Server */
DECLARE @Counter INT
SET @Counter = 1
WHILE (@Counter <= 10)
BEGIN
PRINT 'The counter value is = ' + CONVERT(VARCHAR, @Counter)
SET @Counter = @Counter + 1
END
WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300
BEGIN
UPDATE Production.Product
SET ListPrice = ListPrice * 2
SELECT MAX(ListPrice) FROM Production.Product
IF (SELECT MAX(ListPrice) FROM Production.Product) > $500
BREAK
ELSE
CONTINUE
END
PRINT 'Too much for the market to bear';