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)
 CURSORS

Author  Topic 

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-17 : 03:48:49
Hi all,

I have a simple cursor like this,

DECLARE CURSOR_FOR_INLINE_SELECT CURSOR FOR
SELECT TRNS_ID FROM EEVT
OPEN CURSOR_FOR_INLINE_SELECT
FETCH NEXT FROM CURSOR_FOR_INLINE_SELECT INTO @VAR1

WHILE (@@FETCH_STATUS <> -1)
BEGIN
PRINT @VAR1
FETCH NEXT FROM CURSOR_FOR_INLINE_SELECT INTO @VAR1
END
CLOSE CURSOR_FOR_INLINE_SELECT
DEALLOCATE CURSOR_FOR_INLINE_SELECT

Now that only the selected field(only one, here in case trns_id) is put into a variable, suppose the table contains 50 fields, and I need all the value of these fields should i write INTO @field1, @field2, @field3,,,@field50

pls suggest..


Thanks.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-17 : 05:14:02
yes you would need 50 variavles.

but this is not the way to go. cursors are not good!!

tell us what you're doing. i sure we can come up with a set based solution.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-17 : 05:23:40
what I need is to know all the values of the columns of all the records one by one.........

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-17 : 05:27:03
i get that
but what is the bigger picture? i doubt there is really a need for row by row processing.

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -