what is a cursor and what is its use?
Answers were Sorted based on User's Feedback
Answer / praveen singh
A cursor is a set of rows together with a pointer that
identifies a current row.
In other word, Cursor is a database object used by
applications to manipulate data in a set on a row-by-row
basis, its like recordset in the ASP and visual basic.
DECLARE @fName varchar(50), @lName varchar(50)
DECLARE cursorName CURSOR -- Declare cursor
LOCAL SCROLL STATIC
FOR
Select firstName, lastName FROM myTable
OPEN cursorName -- open the cursor
FETCH NEXT FROM cursorName
INTO @fName, @lName
PRINT @fName + ' ' + @lName -- print the name
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM cursorName
INTO @fName, @lName
PRINT @fName + ' ' + @lName -- print the name
END
CLOSE cursorName -- close the cursor
DEALLOCATE cursorName -- Deallocate the cursor
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / ramesh
when we execute any query its return result set. directly
to work on result set we use cursors.
but right now no one is supporting cursors.
| Is This Answer Correct ? | 3 Yes | 0 No |
How to maintain a fill factor in existing indexes?
how to dispaly a particular row details from a given table
Can we call stored procedure in view in sql server?
Difference between Triggers and Stored Procedure
23 Answers Claimat, HCL, Protech, Silgate,
I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration
Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio
What is storeprocedure?Tell me synatx for how to write stored procedure.
What is meant by datasource?
Do you know what is a linked server in sql server?
What have included columns when we talk about sql server indexing?
What are the types of resultset?
Can anyone tell that the extra features are there in SQL SERVER 2008 that are not available in previous versions .
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)