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
 Transact-SQL (2000)
 Navigate and display record in store procedure

Author  Topic 

imughal
Posting Yak Master

192 Posts

Posted - 2004-06-08 : 02:09:54
hi,

i am looking for navigate and display record in stored procedure.
to navigate record i have uased below cursor

DECLARE my_cursor CURSOR
FOR select filename from fileinfo where caclientsloginid=11
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT From my_cursor
END

now i want to display each record fetch by the cursor. tell me how to display each record. regards, irfan

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-06-08 : 02:34:24

Check out Books Online for cursor syntax.

As a quick guide, you need to declare variables to receive the output of the cursor statement:

DECLARE @cFileName varchar(50)

DECLARE my_cursor CURSOR
FOR select filename from fileinfo where caclientsloginid=11

OPEN my_cursor

FETCH NEXT FROM my_cursor INTO @cFileName

WHILE @@FETCH_STATUS = 0
BEGIN
Print @cFileName
FETCH NEXT From my_cursor INTO @cFileName
END

CLOSE my_cursor

DEALLOCATE my_cursor




Go to Top of Page

imughal
Posting Yak Master

192 Posts

Posted - 2004-06-08 : 03:04:01
thanks for your reply. is there anyway to retrieve these record in asp and display through asp file like while not eof. i m using but getting following error

Operation is not allowed when the object is closed.

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2004-06-08 : 03:46:58
You would be better off fetching a range of rows using something like getrows() and then paging through them at the ASP side. The method you are suggesting here would be most inefficient.

-------
Moo. :)
Go to Top of Page
   

- Advertisement -