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
What should be the fill factor for indexes created on tables? : sql server database administration
List the different types of collation sensitivities in sql server?
What is sql injection and why is it a problem? : sql server security
What is a print index?
What is the difference between coalesce() & isnull()?
Which data types generate inaccurate results if used with an = or <> comparison in a where clause of a sql statement?
Explain trigger and its types?
How to get the definition of a view out of the sql server?
What is set nocount on?
When would you use an insert into .. Select option versus an insert into .. Values option? Give an example of each?
What is the difference between getdate and sysdatetime?
What is transaction server auto commit?
State a few properties of relational databases?
What is scan table/view and seek table/view when its occurs? : sql server database administration
What is 1nf 2nf?