DECLARE @value int, @counter int;
SET @value = 2;
SET @counter = 1;
WHILE @counter < 5
BEGIN
SELECT POWER(@value, @counter)
SET NOCOUNT ON
SET @counter = @counter + 1
SET NOCOUNT OFF
END;
GO
-----------
2
(1 row(s) affected)
-----------
4
(1 row(s) affected)
-----------
8
(1 row(s) affected)
-----------
16
(1 row(s) affected)