Simple example for difference between select and cursor in sql
- 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 |
What is the purpose of the model database?
What meant by Performance Tuning,how can we do the performance tuning on stored procedures and tell some steps to do the performance tuning
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 ...."??
How fixed length strings are truncated and padded?
Would it be a good idea to create an index on a table that always contains 10 records? Why or why not?
how to rest identity columns in sql server
When should you use an instead of trigger?
Explain foreign key in sql server?
How to delete an existing row with delete statements in ms sql server?
How to change the password of a login name in ms sql server?
What is meant by indexing?
What do you mean by the term 'normalization'?