What are cursors? Name four types of cursors and when each
one would be applied?

Answers were Sorted based on User's Feedback



What are cursors? Name four types of cursors and when each one would be applied?..

Answer / sreyasmn

Cursors can be either updateable or non-updateable. If you
only need to display information and not diddle with it,
the non-updateable is the fastest. The provider simply
passes you the data and forgets about it! There is no need
to keep tabs on the data to see if it has been changed.
Therefore, this is the fastest cursor to use.



Cursor type

Static cursor. This is the one to use for generating
reports or finding data. Additions, changes, or deletions
by other users are not visible

Forward-only cursor. This is the default. It is identical
to the Static except that you can only scroll forward. The
fastest cursor this side of the Pecos Mountains.

Dynamic cursor. Additions and deletions by others are
visible. All movement is supported. But some providers
don't support this cursor type.

Keyset-driven cursor. This is similar to a Dynamic cursor
except you can't see records others add. If another user
deletes a record, it is inaccessible from your recordset

Is This Answer Correct ?    46 Yes 13 No

What are cursors? Name four types of cursors and when each one would be applied?..

Answer / basha

Following are different types of cursors available in SQL Server 2005 :

Base table
Static
Dynamic
Forward-only/Read-only
Keyset-driven

Base table: Base table cursors are the lowest level of cursor available. Base table cursors can scroll forward or backward with minimal cost, and can be updated

Static: Cursor can move to any record but the changes on the data can’t be seen.

Dynamic: Most resource extensive. Cursor can move anywhere and all the changes on the data can be viewed.

Forward-only: Cursor moves one step forward, can’t move backwards.

Keyset-driven: Only updated data can be viewed, deleted and inserted data cannot be viewed.

Is This Answer Correct ?    3 Yes 2 No

What are cursors? Name four types of cursors and when each one would be applied?..

Answer / khushboo rastogi

A cursor is a temporary work area created in the system memory when a SQL statement
is executed. A cursor contains information on a select statement and the rows of data
accessed by it. This temporary work area is used to store the data retrieved from the
database, and manipulate this data. A cursor can hold more than one row, but can process
only one row at a time. The set of rows the cursor holds is called the active set.

There are two types of cursors in PL/SQL:

Implicit cursors:

These are created by default when DML statements like, INSERT, UPDATE, and
DELETE statements are executed. They are also created when a SELECT statement that
returns just one row is executed.

Explicit cursors:

They must be created when you are executing a SELECT statement that returns more
than one row. Even though the cursor stores multiple records, only one record can be
processed at a time, which is called as current row. When you fetch a row the current row
position moves to next row.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is RAID? What are the different types of RAID configurations?

0 Answers   Flextronics,


Why SQL Agent is used?

0 Answers   Abacus,


Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security

0 Answers  


What is an index?

8 Answers   Yardi Software,


What is a function? Give some example?

3 Answers  






How to connect php with different port numbers?

0 Answers  


How to find the login name linked to a given user name?

0 Answers  


If i have one transaction say mainTransaction, within this mainTransaction i have another two transaction say t1 and t2. Now while execution t1 completes successfully and commit statement fires, but while executing t2 some error occurs and rollback statement fires. What happen to t1, is it rollback or not?

1 Answers   Ness Technologies,


What are joins in sql and what are the different types of joins?

0 Answers  


What is SQL server agent?

2 Answers   HCL, SAP Labs,


Can XML be used to access data?

2 Answers  


What do you mean by cardinality?

0 Answers  


Categories