Sunday 13 October 2013

SQL Server While Loop Example with stored procedure

To use while loop in stored procedure we need to write the query like this

DECLARE @loop INT
SET @loop = 0
WHILE @loop <= 10
BEGIN   
SET @loop = @loop + 1   
PRINT @loop
END

No comments:

Post a Comment