![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
For all the rows in this recordset: Select emailAddress, customerNum from customers I would like to call this stored procedure: EXEC sp_SMTPemail 'from (AT) address (DOT) com', emailAddress, 'Subjecttext','Messagetext - Your CustomerNumber is' + customerNum Can I do this in DTS? Or can this been done in the stored procedure? I want to call the stored procedured for every row returned from the sql |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thanks for the note Alan. Below is a store procedure with a cursor to call my stored procedure to send email How can I add text plus the |
|
CREATE PROCEDURE sp_CursorToSendMail as DECLARE @Store nvarchar(10) DECLARE @Email_Recipient nvarchar(30) DECLARE @Submission datetime(8) DECLARE @MyCursor CURSOR SET @MyCursor = CURSOR FAST_FORWARD FOR SELECT DISTINCT tblItemOrder.Store, cp_RM00106.Email_Recipient, tblItemOrder.Submission FROM tblItemOrder INNER JOIN cp_RM00106 ON tblItemOrder.Store = cp_RM00106.CUSTNMBR OPEN @MyCursor FETCH NEXT FROM @MyCursor INTO @Store, @Email_Recipient, @Submission WHILE @@FETCH_STATUS = 0 BEGIN BEGIN EXEC xp_cdosendmail @Address = @Email_Recipient, @message = 'Your order was received for ' + @Store + ' on ' + @Submission + '. Any questions please call at 608', @Subject = 'Order received for for ' + @Store + ' on ' + @Submission, @From = 'khofn (AT) hvees (DOT) com' FETCH NEXT FROM @MyCursor INTO @Store, @Email_Recipient, @Submission END CLOSE @MyCursor DEALLOCATE @MyCursor GO |
![]() |
| Thread Tools | |
| Display Modes | |
| |