adspace
how to create a scrollable cursor with the scroll option? : Sql server database administration
Answer Posted / Pradip Kumar Srivastava
"DECLARE @cursor CURSOR FOR SELECT * FROM table_name; OPEN @cursor; DECLARE @row CURSOR_STATUS; SET @row = 0; WHILE (@row <> -1) BEGIN FETCH NEXT FROM @cursor INTO @var1, @var2, ..., @varN; SELECT @row = @@FETCH_STATUS; IF (@row > 0) CONTINUE; END; CLOSE @cursor; DEALLOCATE @cursor": This code creates a scrollable cursor that allows you to move backward and forward through the result set. The addition of the "scroll" option in the FETCH NEXT statement enables this functionality.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
List the ways in which dynamic sql can be executed?
How to convert character strings into numeric values?
What is in place upgrade in sql server?
How efficient you are in oracle and SQL server?
When should you use an instead of trigger?
Can we shrink data file in sql server?
How do I start sql server 2017?
What are different types of constraints?
what is the difference between openrowset and openquery?
What is the difference between upgrade and migration in sql server?
Can one drop a column from a table?
What is sql or structured query language?
How to rebuild the master database?
What is an indexed view?
How to enter binary string literals in ms sql server?