Simple example for difference between select and cursor in sql

Answer Posted / manoj pandey

- SELECT is a Query operator, which is also called a set-based approach.

- CURSOR is a looping operator, which is also called a iterative approach or no-set based approach.

Ideally SELECT is more performant than CUSROSR, but there are certain scenarios when CURSOR are the last approach and sometimes beneficial.

More about Cursors:
- Cursor Life Cycle: http://sqlwithmanoj.wordpress.com/2010/10/24/sql-server-cursor-life-cycle/
- Cursor Performance: http://sqlwithmanoj.wordpress.com/2011/02/07/avoid-cursors-or-use-them-optimally/

Check my blog for more Interview Questions: http://sqlwithmanoj.wordpress.com/interview-questions/

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the essential components of sql server service broker?

560


what's the maximum size of a row? : Sql server database administration

540


How to perform backup for certificates in sql server? : sql server security

595


What is efficiency data?

520


What are entities and relationships?

548






What is cte (common table expression)?

593


What is service broker? : sql server database administration

572


What is the difference between primary key and unique constraints?

506


How to find out what is the default collation in a database?

619


What is resource governor in sql server?

544


How to delete exactly duplicate records from a table?

601


What is global temp table?

552


When cursors are useful?

573


Do you know what are the differences between lost updates and uncommitted dependencies?

535


What is the difference between varchar and nvarchar?

520