ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
what is a cursor and what is its use?
 Question Submitted By :: Vishu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is a cursor and what is its use?
Answer
# 1
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 ?    3 Yes 1 No
Praveen Singh
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What all db objects can be found in MSDB database of a SQL Server instance? Accenture1
How do you find the number of rows in a table?  5
Where do you think the users names and passwords will be stored in sql server?  3
How do we get month name in SQL Server 2000, Oracle, MS Access?  9
How many max. conditions can b written under the WHERE clause? Like select * from [tabnam] WHERE (cond1...or..cond2....or...cond3...and.....so on.....??? (upto how much extent))????? SAP-Labs2
What is a transaction and what are ACID properties? IBM4
can you any body tell me why are go for the rebuild the master database.what is the reason?  1
Wht is Stuff in sql ser  1
Can we use Truncate command on a table which is referenced by FOREIGN KEY?  2
what is Constraint? How many types of constraints in SQL ? NIIT7
What is the use of DBCC commands?  1
Can you tell me the difference between DELETE & TRUNCATE commands?  11
What is a join and their types? Challenger-Financial2
what is web server? Satyam3
what is the Enterprise manager(2000) and management studio (2005)?  2
WHAT IS TRIGGERS IN SQL? AND WHAT IS THE BENIFIT?  5
explain different types of jions with examples briefly? Zensar1
What is user stored procedure & it purpose? Wipro3
can you any body tell me the difference between candidate key and primary key  4
what is maximum size of temp db? iSoft4
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com