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 the purpose of a table?

0 Answers  


What is dbcc? Give few examples.

0 Answers  


Is mysql better than sql server?

0 Answers  


What is difference between sql and sql server?

0 Answers  


What is sql sandbox in sql server?

0 Answers  






How to create an identity column?

0 Answers  


Tell me what do you mean by an execution plan? Why is it used? How would you view it?

0 Answers  


What is a trace frag? Where do we use it?

0 Answers  


What are difference between Cluster index and Non-Cluster index?

0 Answers   QuestPond,


What do you know about system database? : SQL Server Architecture

0 Answers  


What is the maximum number of instances in 32 bit and 64 bit sql server 2012?

0 Answers  


write sql program to get the detail of student in a class?

2 Answers  


Categories