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 in SQL Server 2000 and their types?

Answer Posted / vasanthi

When will be use cursor need to perform following steps:-

1. DECLARE CURSOR

2. OPEN

3. FETCH

4. @@FETCH_STATUS

5. CLOSE

6. DEALLOCATE


1.DECLARE cursor_name CURSOR FOR SELECT_statement;

2.OPEN cursor_name;

3.FETCH cursor_name INTO variable list;

5.CLOSE cursor_name;

5.DEALLOCATE cursor_name;


sample
******

DECLARE Employee_Cursor CURSOR FOR
SELECT LastName, FirstName
FROM AdventureWorks2008R2.HumanResources.vEmployee
WHERE LastName like 'B%';

OPEN Employee_Cursor;

FETCH NEXT FROM Employee_Cursor;
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM Employee_Cursor
END;

CLOSE Employee_Cursor;
DEALLOCATE Employee_Cursor;

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I find the sql server instance name?

967


What are the rules to use the rowguidcol property to define a globally unique identifier column?

1021


What are the different types of replication are there in sql server 2000?

1043


What does it mean to invest in the index?

973


How many types of stored procedures are there in sql server?

1015


What do you understand by hotfixes and patches in sql server?

991


How to create a user name in a database?

1054


What is the difference between value type and reference type?

921


Explain something about security and SQL Azure?

134


Tell me what is fill factor?

964


Can you pass expressions to function parameters?

1103


What is the purpose of grouping data in a report?

968


How we create SQL Server 2005 Reporting Services ? Give me Sample

1992


What is an index in a database?

979


What guidelines should be followed to help minimize deadlocks?

943