|
DECLARE myCursor CURSOR
LOCAL
FAST_FORWARD
FOR SELECT Name FROM EMP
DECLARE @Name char(10)
DECLARE @i tinyint
OPEN myCursor
SET @i = 0
WHILE @i < 5
BEGIN
FETCH myCursor
INTO @Name
SET @i = @i + 1
SELECT 'No.' + STR(@i)+' Person is '+ @Name
END
CLOSE myCursor
DEALLOCATE myCursor
|