Write the Syntax for Cursors.

Answer Posted / govardhana r

DECLARE @var1 varchar(20), @var2 varchar(20)

declare cursor_name cursor for
select val1,val2 from table_name

open cursor_name

fetch next from cursor_name
into @var1, @var2

while @@FETCH_STATUS = 0
begin
-----
-----
-----
fetch next from cursor_name
into @var1, @var2
end

close cursor_name
deallocate cursor_name

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In what three ways is the return statement used in a stored procedure?

526


How to insert data into an existing table?

576


Explain the various types of concurrency problem?

709


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

532


What is the recursive stored procedure in sql server?

538






Explain differentiate between a having clause and a where clause?

523


what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?

1587


What security features are available for stored procedure?

601


What action plan is preferred if sql server is not responding?

548


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

1501


What is dbcc? Give few examples.

586


How to configure odbc dsn with different port numbers?

575


What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?

569


what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration

546


What is extended stored procedures?

576