Dot Net: Some Thing About Cursor
As the name suggest cursor means the pointer location which expend where is pointer right now .Cursor helps in processing of result taken from result query row by row. Its means records taken into existing row by row or u can say one record at one time. There are many types of cursor some of this are as follows:-
Static Cursor
Dynamic Cursor
Forward Only Cursor
Keyset-Driven.
To understand the complete meaning of recordset we take a simple meaning that helps u to understand what cursor is and how it helps when we execute a SELECT statement its return a no of rows this result is just like whole one thing .Now questions arise how will we take this result output and make a part of that result so cursor helps in this situation to resolve the problem .Cursor is just a server side recordset when we use ADO. Cursor also possible in ado.
Another definition of cursor is just a number of row together on which pointer is just a identifier of current row and T-SQL helps cursor to move further to next row there are no of statement which comes in creating cursor and there maintenance.
(1)DECLARE CURSOR:-Declare cursor do some basic operation relates to cursor. Just like to aside storage for cursor.
(2)OPEN:- The open statement used to fill up the cursor with the data and this data helps cursor to make connection with the data.
(3)FETCH:- fetch used to retrieve data from cursor to a variable means we can get data from cursor with the variable.
(4)CLOSE:- The close statement is just reverse of open statement this do the closing action fro the cursor.
(5)DEALLOCATE:-Deallocate is just opposite of declare cursor statement.
There are some disadvantages of cursor too cursor takes roundtrip so quite network remain busy. Cursor require lost of resources so slow and time consuming. And temporary storage also increases when using curser.
Learn more about Sql Server Interview Questions at dotnetquestion.info
Related keywords for this page:
php,programming,application