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

What is indexed view?

972


Explain the collation?

1099


how many triggers you can have on a table? : Sql server database administration

968


How will you optimize a stored procedure optimization?

1026


Is it true, that there is no difference between a rule and a check constraint?

1031


What is a DBMS, query, SQL?

1041


What is primary key index?

973


Define self join in sql server joins?

944


Is sql server 2016 free?

927


How to disable triggers using "disable trigger"?

1047


What is the difference between the application object and session object?

1056


What is use of attribute hierarchy ordered ? : sql server analysis services, ssas

1004


What is the default port for SQL Server over a firewall?

1082


List layers of abstraction microsoft architectured to provide relational db through cloud platform ?

183


What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?

949