What are Cursors in Sql-Server?

 Posted by Rajesh_Kumar on 1/22/2014 | Category: Sql Server Interview questions | Views: 2071 | Points: 40

Cursors are known for fetching row one by one fom a table.Actually they work just like as For-loop or while-Loop. Cursor always fetch one record at a time.
A cursor allows us to iterate a set of rows returned by a query and process each row accordingly.
Actually we should not use cursors because they degrade performance of database and also uses lots of server resources.ecause if there are lakhs of rows and cursor is manipulating each row one by one then definitely it will slow the performance of database.
We always write Cursors inside stored procedure.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response