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 Administration (2000)
 RE. SQL MAIL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-11 : 09:22:17
david majors writes "Dear Sql Team,

I have a database of customers that I am trying to send email messages reminding them of their past due balance. All recipients have email addresses. WHEN I ISSUE THIS SCRIPT I GET AN ERROR:
Rock Island Acct.#3100
SANTA MARKET
10.30
Msg 17914, Level 18, State 1
Unknown recipient: Parameter '@recipients', recipient '@MyRecipients'

This is my script:

SET NOCOUNT ON
Declare @MyRecipients varchar (255)
Declare @MySubject varchar (255)
Declare @MyMessage varchar (255)
Declare @MyBalance varchar (255)
Declare @MyNumber varchar (255)
Declare @MyCompany varchar (255)
Set @MySubject='Rock Island Reminder'
Set @MyMessage = '****ROCK ISLAND REMINDER**** This is to inform you that your account is Past Due. Please contact our office to discuss your account @ 415-884-6466 Mon-Fri 8:00 AM to 5:00 PM.'
Declare MyCursor Cursor For
Select rcust.emailaddresspart,rcust.Accountbalance,'Rock Island Acct.#' + rcust.CustomerNumber,rcust.CustomerName From RCUST
Where rcust.AccountBalance>0.01 AND rcust.emailaddresspart like '%@%'
Open MyCursor
Fetch Next From MyCursor Into @MyRecipients,@MyBalance,@MyNumber,@MyCompany
While @@Fetch_Status = 0
BEGIN
Print @MyRecipients
Print @MyNumber
Print @MyCompany
Print @MyBalance
Fetch Next From MyCursor Into @MyRecipients,@MyBalance,@MyNumber,@MyCompany
Exec Master.dbo.xp_sendmail @Recipients='@MyRecipients',@Subject=@MyNumber,@Message=@MyMessage
End
Close MyCursor
Deallocate MyCursor

**************Please let me know what the problem is. I checked the sql mail and it works fine. ***********.

David"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-07-11 : 09:38:51
only issue I can see is the single quotes around '@MyRecipients', why are they there?....your other text fields don't have quotes around them when you are passing them in......


Go to Top of Page
   

- Advertisement -