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.
| Author |
Topic |
|
vegasvic
Starting Member
4 Posts |
Posted - 2005-09-06 : 16:58:53
|
| I have written a stored procedure that steps through a table in the db and populates 2 variables. The next step is to use another stored procedure that I have that send email using cdonts. 1st problem is I cant get the @CustomerId variable to concatenate into the paramaters to pass to the sp that send mail via cdonts.2nd I tried hardcoding all the variables and it does not send the email at all. could someone review the code and give me some advicethanksVegas VicCode Below:CREATE procedure dbo.sp_emailECOMRPTS asdeclare@CustomerId as varchar(20),@EmailAddy as varchar(255)DECLARE C1 CURSOR READ_ONLYFOR SELECT CustomerID,EmailFROM CustomersWHERE HasReports = 1 and Email is not NullOPEN C1FETCH NEXT FROM C1 INTO @CustomerId,@EmailAddyWHILE (@@fetch_status <> -1)BEGIN IF (@@fetch_status <> -2) BEGIN exec sp_send_cdontsmail 'emgeserver@emgeast.com',@EmailAddy,',EMGE Inventory Revised with Vendor Sort','This is an automated Email. Please do not respond to it. Questions regarding this email should be directed toEMGCustomerService','','Z:\'@CustomerId'\Inv\101185tblInv9-6-2005.rpt' END FETCH NEXT FROM C1 INTO @CustomerId,@EmailAddyENDCLOSE C1DEALLOCATE C1GO |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2005-09-06 : 17:32:54
|
| CDONTS is deprecated, CDOSYS is it's replacement. There are several stored procs available that work with CDOSYS to send email. Do a search on the main site or via google and you should find 2 or 3 that will work for you.-ec |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
|
|
|
|
|
|
|