Jul 9, 2010

what is the cursor

Cursors are used to fetch the records row by row data in a
table but get the data very fast by using the cursors it is
very useful if the table contains few records in a table but
will create a performance isses if the table contain lot of
records

create cursor cursorName for 
select EmpId,EmName from Employees
open cursor
while (@@FetchStatus==0)
begin
fetch next from cursorName  into  @EmpId , @EmName 
select * from Employee where empid=@empid
end
close cursor

No comments:

Post a Comment