On Jan 31, 5:03 pm, Erland Sommarskog <
esq...@sommarskog.se> wrote:
Hi Erland and Bob,
Thanks both a bundle for your responses. Looks like there is life on
planet
Google Groups after all, much appreciated!
The specifics is that we are doing email deployments but google is
moving
all of the email sent to gmail users to their spam boxes. As a result,
we have
to "chunk" the gmail users out of the total amount and send in
manageable
batches. We have figured that 80,000 per batch out of the total gmail
users
in the table is possible.
And, Erland, to answer your question, I would prefer to turn this into
a stored
procedure we can use for the purpose of "chunking" email addresses.
Accordingly,
the number per batch should be a variable parameter.
Bob, the table we are querying against is pretty simple. Essentially,
it has one
one column - "email_address" which is a varchar. Its data is about 1
million email
addresses (but that number changes often). The result set table(s)
should only have
two columns, the count (INT) and the email_address (varchar). Please
see below.
The query I am trying to write is supposed to dump each result set
(batch)
to a text file in some folder on the hard drive. Each result set
should have
a count and the email addresses as columns. Something like this:
RESULT 1:
[COUNT] [EMAIL_ADDRESS]
1
na...@gmail.com
2
na...@gmail.com
3
na...@gmail.com
4
na...@gmail.com
5
na...@gamil.com
...
80,000
na...@gmail.com
RESULT 2:
[COUNT] [EMAIL_ADDRESS]
80,001
na...@gmail.com
80,002
na...@gmail.com
80,003
na...@gmail.com
80,004
na...@gmail.com
80,005
na...@gamil.com
...
16,000
na...@gmail.com
And so on up to the to total amount of the gmail addresses out of the
original table.
So, the statement should read something like this (pseudo code):
select all distinct users
from the master table
where email_address like '%
gmail.com'
return in batches of N (such as 80,000)
and write each batch to a text file on the
hard drive.
I hope I have explained myself well. Let me know if anything is
unclear.
Thanks a bundle for your help.