Advantages and Disadvantages of Cursor?

Answer Posted / sarat

Cursors allow row-by-row processing of the resultsets.

Disadvantages of cursors: Each time you fetch a row from the
cursor, it results in a network roundtrip, where as a normal
SELECT query makes only one rowundtrip, however large the
resultset is. Cursors are also costly because they require
more resources and temporary storage (results in more IO
operations). Further, there are restrictions on the SELECT
statements that can be used with some types of cursors.

Most of the times, set based operations can be used instead
of cursors.

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is local temp table?

549


Is sql server 2016 free?

526


Can you insert NULL in unique column?

618


Is it important for a database administrator to understand the operating system and file access?

505


How to write a query with a right outer join in ms sql server?

478






Why do we use trigger?

552


How to trouble shoot if unable to connect SQL Server

1478


We are updating a field in sql and alter the row also.after giving the commit command the system is crashed.what will happen to the commands given,whether it will update and alter the table or not?

901


what are database files and filegroups? : Sql server database administration

497


This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?

2010


Ms sql server index?

534


What is temporary table in sql server? Why we use temp table?

514


What is difference between createstatement and preparedstatement?

538


How to delete duplicate rows in sql server?

570


How to create new databases with "create database" statements?

565