Re: [Emerald] rebatch behind the scenes .... ?

Dan Tang ( (no email) )
Thu, 10 Jun 1999 21:40:33 +0800

A store procedure in SQL 7.0 for you

declare curMailer INSENSITIVE cursor
for select email,firstname,lastname
from subaccounts
where datalength(email)>0
declare @email varchar(50)
declare @FirstName varchar(50)
declare @lastName varchar(50)
declare @MsgBody varchar(2000)

open curMailer
fetch next from curMailer into @email,@firstname,@Lastname
while @@FETCH_STATUS=0
Select @MsgBody='Dear ' + @FirstName + ' ' + @LastName + ',' + char(13)
select @MsgBody='Your main message here' + char(13) + char(13)
select @MsgBody='Regards,'+ char(13) + char(13)
select @MsgBody='Your title'
exec master..xp_sendmail @recipients=@email,
@subject='Your subject',
fetch next from curMailer into @email,@firstname,@Lastname
close curMailer
deallocate curMailer

To test it, run this on SQL7.0 QueryAnalyzer, replace @email the
@receipients=@email with your email address like that

Because this is a store procedure, you can acctually set up a ASP page,
which you can type in the message and let the Web Server and SQL 7.0 handle
the rest.


Dan Tang
Network Operation
Domain Internet Access
Sign Up a Dial up account at and get connect right
Join the Emerald ASP Addon Product mailing list
by sending email to with message body SUBSCRIBE

-----Original Message-----
From: Alexander Blauvelt <>
To: <>
Date: Wednesday, June 09, 1999 11:40 PM
Subject: Re: [Emerald] rebatch behind the scenes .... ?

>> Might I suggest if this is to happen that it's not a feature enabled by
>> default :^)
>> Most banks would at best kick you up the ass for "guessing" CC expiry
>> and some will withdraw merchant facilities...
>OUCH. That i didn't know. Perhaps we could have a script that
>emailed the customer to please call with new credit card information.
>Unfortunately I don't know enough about sql server and scripting to be
>able to do this. Anyone have an idea on how this could be done ?
>Online Gateway