Home > DeveloperSection > Interviews > Concept of cursor in database?

Posted on    October-20-2010 12:00 AM

 MSSQL Server MSSQL Server 
Ratings:
 1 Answer(s)
  955  View(s)
Rate this:

Rajesh Goswami

Total Post:85

Points:425
Posted on    November-09-2010 1:00 AM

Cursors provide a mechanism by which a database client iterates over the records in a database. Using cursors, the client can get, put, and delete database records. Database programmers use cursors for processing individual rows returned by the database system for a query.

Working with cursor:
Syntax:
Declare a cursor
DECLARE cursor_name CURSOR FOR SELECT ... FROM ...

Open a cursor

OPEN cursor_name

Fetch Cursor

FETCH cursor_name INTO ...

Close Cursor
CLOSE cursor_name





Don't want to miss updates? Please click the below button!

Follow MindStick