Simple example for difference between select and cursor in sql



Simple example for difference between select and cursor in sql..

Answer / 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

More SQL Server Interview Questions

What is the purpose of the model database?

0 Answers  


What meant by Performance Tuning,how can we do the performance tuning on stored procedures and tell some steps to do the performance tuning

3 Answers   TCS,


system date format is "yy-mm-dd" "select getdate()" ----> 2009-01-24 20:03:28.513 if i write "select dateadd(dd,2,getdate()) ".it returns "2009-01-26 19:59:38.340"...my question is dat could it be possible to retrive da date in da format "26 jan 2009 ...."??

8 Answers  


How fixed length strings are truncated and padded?

0 Answers  


Would it be a good idea to create an index on a table that always contains 10 records? Why or why not?

3 Answers  


how to rest identity columns in sql server

3 Answers   Matrix,


When should you use an instead of trigger?

0 Answers  


Explain foreign key in sql server?

0 Answers  


How to delete an existing row with delete statements in ms sql server?

0 Answers  


How to change the password of a login name in ms sql server?

0 Answers  


What is meant by indexing?

0 Answers  


What do you mean by the term 'normalization'?

0 Answers   Tech Mahindra,


Categories