簡單迴圈
CREATE PROCEDURE SprocWithSimpleLoop
(
@SayThis VARCHAR(30),
@ThisManyTimes INT
)
AS
BEGIN
WHILE @ThisManyTimes > 0
BEGIN
PRINT @SayThis;
SET @ThisManyTimes = @ThisManyTimes - 1;
END
RETURN;
END
GO