The function is a smtp email function that only sends 1 email at a time. So
yes, each record or item needs to be processed one at a time.
"Stuart Ainsworth" wrote in message
On Apr 16, 8:20 pm, "scott" wrote:
> I'm working on a script that creates a temp table called #tmpList.
>
> How can Loop through the records of #tmpList? So far in my using SQL, I've
> always written SQL statements to just return records and I did my looping
> with VB. I need to be able to loop through the temp table and perform a
> function on each email name that exists in my temp table.
>
> EXAMPLE:
>
> -- #tmpList Table shown below
>
> myEmails
> --------------------
> us....RemoveThis@cnn.com
> us....RemoveThis@cnn.com
> us....RemoveThis@cnn.com
A general rule of thumb is that before you think about looping in SQL,
be sure that you absolutely have to do it this way. Although you can
use a CURSOR (hint: look up cursors in the Books Online for usage),
they're usually not the best solution to a problem.
Does your function have to perform on one item at a time? What does
the function do? Does it really belong at the data layer, or should
you be returning the data set to a client that iterates through a
collection, performing a function at that level.
Stu
>> Stay informed about: Loop through Table Records