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
 SQL Server Development (2000)
 SQL Query Problem

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2003-05-21 : 20:32:05
We have 2 separate tables that include a total of 12,000 email addresses. Each table may include some duplicate emails as compared to the other (and within itself). We want to divide up the addresses so that mailings are sent to only 500 emails at a time every 10 minutes. We know how to run a scheduler that runs a sql query every 10 minutes but are having trouble coming up with the proper query.

Here are the requirements:

1. Send to the email addresses that are on the east coast first (we already have the zip codes) and continue across the country, so that the newsletters are received at appx. the same part of the day.
2. Exclude any duplicate email addresses.
3. Keep the query time to a minimum to reduce server load since it’s run every 10 minutes.

We’ve tried a join of the two tables using the top 250 in each, but that doesn’t retrieve the emails based on zip code order, nor does it exclude duplicates as some customers may include different zip codes for the same email address.

Any ideas would be appreciated. Many thanks in advance.


Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-05-21 : 21:10:56
You could do something like this : http://www.sqlteam.com/item.asp?ItemID=5908

but only return TOP 500 rows each time to the queue.

Damian
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-21 : 21:14:09
Why don't you run a separate procedure to eliminate the duplicates regularly?

Sam

Go to Top of Page
   

- Advertisement -