Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is a cursor and what is its use?

Answers were Sorted based on User's Feedback



what is a cursor and what is its use?..

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

what is a cursor and what is its use?..

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

Post New Answer

More SQL Server Interview Questions

How to maintain a fill factor in existing indexes?

0 Answers  


how to dispaly a particular row details from a given table

2 Answers  


Can we call stored procedure in view in sql server?

0 Answers  


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

0 Answers  


Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio

0 Answers  


What is storeprocedure?Tell me synatx for how to write stored procedure.

1 Answers   Cap Gemini,


What is meant by datasource?

0 Answers  


Do you know what is a linked server in sql server?

0 Answers  


What have included columns when we talk about sql server indexing?

0 Answers  


What are the types of resultset?

0 Answers  


Can anyone tell that the extra features are there in SQL SERVER 2008 that are not available in previous versions .

0 Answers   HCL,


Categories