You learn something new everyday! Thanks for introducing me to
another way to write useful proceedures, I appreciate it.
It works great.
Alan
>From: "Arbon Reimer" <arbon_reimer@h...>
>Reply-To: "sql language" <sql_language@p...>
>To: "sql language" <sql_language@p...>
>Subject: [sql_language] Re: looping thru field list
>Date: Tue, 24 Apr 2001 13:22:44 -0600
>
>You could just use a cursor if you wanted, according to your description...
>doesn't sound like a need to add a temporary table unless you definitely
>want to stash it in a table... even then a cursor sounds like it would work
>for you.
>
>Declare @variable INT --holds the ID number
>Declare curCursorLoop CURSOR FOR SELECT someIDno FROM someTable WHERE
>someCriteria = someCriteria
>FETCH NEXT FROM curCursorLoop INTO @variable --picks one ID number from
>the
>set of records that your SQL statement selected.
>WHILE @@FETCH_STATUS = 0
>BEGIN
> do processing here....
>FETCH NEXT FROM curCursorLoop INTO @variable --move on to the next one.
>END
>CLOSE curCursorLoop --clean up
>DEALLOCATE curCursorLoop
>
>HTH!
>Regards,
>-Arbon Reimer
>
>
>----- Original Message -----
>From: "Alan Grobert" <alangrobert@h...>
>To: "sql language" <sql_language@p...>
>Sent: Tuesday, April 24, 2001 12:36 PM
>Subject: [sql_language] looping thru field list
>
>
> > After running a SELECT someIDno INTO a tempdb I would like to loop thru
>the
> > resulting list of someIDno's using each one in turn in the
> > WHERE nointable = someIDno statement. In other words, I need to run a
> > history on each IDno as it is added to the table everyday.
> >
> > Alan Grobert alangrobert@h...
> > _________________________________________________________________