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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-03-06 : 21:03:58
|
Alaric writes "Hello,
I have the following problem : In an ASP page, I use a stored procedure to retreive some datas (30 rows per page) from a table (which contains about 30 000 rows). Of course, I don't want to extract the whole database for each selection, so I buid the following Stored procedure :
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CREATE PROCEDURE [dbo].[selectquery] @start int, @finish int, @query text
AS
execute ('DECLARE Cur SCROLL cursor for '+@query) OPEN Cur FETCH RELATIVE @start FROM Cur
WHILE @start<@finish
BEGIN FETCH NEXT FROM Cur Set @start=@start+1 END
CLOSE Cur DEALLOCATE Cur GO
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
In the query analyser, I run the following command :
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EXEC selectquery '1','30','select ProductID, name, Price from products ORDER BY ProductID DESC'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
As you can imagine, I get 30 datagrid width 1 row in each of them, instead of a single datagrid with 30 rows. How can I solve this problem ??
Thanks for your help and congratulation for your website." |
|
|
|
|
|
|
|