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 |
What is the difference between inner join and equi join?
what is package configuration variable?How to change file name in folder dynamically?Plz help me
What is the purpose of indexing?
Why the trigger fires multiple times in single login?
if 3 duplicate records in a table,i want to delete 2 duplicate records by keeping 1 duplicate and 1 original as it is,how?
What is the use of placing primary key and foreign key constrains on columns.
Explain Normalization and DE normalization
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
what is the difference between group and having give an example with query and sample output
Define right outer join?
Explain the commands in sql server?
What is difference between materialized view and view?