Cursor Management

DECLARE @Person char(50)
DECLARE @FirstName VARCHAR(50)

DECLARE c1 CURSOR FOR
select Person, FirstName from Person

OPEN c1
FETCH NEXT FROM c1
INTO @Person,@FirstName

WHILE @@FETCH_STATUS = 0
BEGIN
	PRINT @Person +  @FirstName
	FETCH NEXT FROM c1
	INTO @Person, @FirstName
END

CLOSE c1
DEALLOCATE c1

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

AddThis Social Bookmark Button

Similar Posts

Comments are closed.