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 |
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?
0 Answers Amdocs, Apps Associates,
How to delete duplicate rows from table except one?
What is awe?
What is importing utility?
Why I am getting this error when renaming a database in ms sql server?
What is the use of CASCADE CONSTRAINTS?
How do I install sql server?
What are the components of sql server service broker?
Which is the main third-party tool used in sql server?
What is isolation levels?
What is user-defined function?
Using query analyzer, name 3 ways you can get an accurate count of the number of records in a table?