Write the Syntax for Cursors.

Answers were Sorted based on User's Feedback



Write the Syntax for Cursors...

Answer / 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

Write the Syntax for Cursors...

Answer / ranjith kumar

declare cursor_name cursor for
select * from table_name
open cursor_name
fetch next from cursor_name

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More SQL Server Interview Questions

How to populate a table in sql server?

0 Answers  


What is tabulation?

0 Answers  


What is MSDE?

2 Answers  


What are the different index configurations a table can have?

0 Answers  


I Have Employee table having column name as ID,SALARY how to get second max salary from employee table with id ex ID SALARY 1 20000 7 37000 2 5000

17 Answers   HCL, IBM,






How can I create a new template for import ? : sql server management studio

0 Answers  


What is the need for group functions in sql?

0 Answers  


What is the difference between stored procedure and user defined functions?

0 Answers  


What is Extended user-defined?

0 Answers  


How do you debug a procedure in sql server?

0 Answers  


how can you move the master database

1 Answers   IBM,


How can you insert null values in a column while inserting the data?

0 Answers  


Categories