Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Cursor returning single rows

Author  Topic 

cecilius
Starting Member

19 Posts

Posted - 2002-09-14 : 08:34:09
How can i advide a cursor not to return any row seperate (in MS-SQL-Query), i mean in a seperate grid, but instead all concerning rows together like a "normal" select-statement (i mean all rows in one grid)?

After defining and opening my cursor looks like this:

SET @lfd = 1
WHILE @lfd < @PageRecords
BEGIN
FETCH NEXT FROM CSummeAuktion
SET @lfd = @lfd + 1
END

--edit:
once more: i mean, is there any posiblity to collect all rows while looping through the cursor, and then after finishing send them all together to the client, like a "normal" select does?




Edited by - cecilius on 09/14/2002 08:41:30

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-09-14 : 08:37:42
Use a normal select statement. A cursor is firing off many separate statements

Damian
Go to Top of Page

cecilius
Starting Member

19 Posts

Posted - 2002-09-14 : 14:28:39
Hi Damian,
thx for posting. Is there really no way?

quote:

Use a normal select statement. A cursor is firing off many separate statements

Damian



Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-09-14 : 14:47:43
No. A cursor that performs multiple FETCHes will return each row as a separate recordset. Dont' use a cursor; just use the SELECT statement that declares the cursor and all of the rows will be return as one recordset.

If you want to number the rows, search SQL Team for "row number" and you'll find several articles on how to do it. The same applies for "recordset paging" or just "paging". If you need to display pages of rows, I suggest you do that using the ADO paging methods, don't try to do it on the SQL Server side unless absolutely necessary. There are a few links that describe ADO paging.

Go to Top of Page
   

- Advertisement -