Stacey writes "Working with a web application which I have a trigger that runs on a table which simply changes the status_id field to 3 when the datetime_completed field is updated:CREATE Trigger CloseRequest ON [Tickets] FOR UPDATEASIf Update(datetime_completed)Begin If (SELECT datetime_completed FROM inserted) Is Not NULLBegin Update Tickets Set status_id = 3 From inserted b, Tickets a Where a.ticket_id = b.ticket_idEndEnd----------What I would like to do now is add onto this trigger to execute a sp passing a few fields as variables from this updated record to it - for instance, the cust_email. It is a sp that I found on a sql site that uses cdonts to email via SMTP. The cust_email being the @to. I am at a loss at to how to pass the cust_email value over as the @to variable. Any ideas? CREATE PROCEDURE SP_CDONTS_NewMail_Send@to VARCHAR(8000) @from VARCHAR(8000)@subject VARCHAR(8000)@body VARCHAR (8000) ASDECLARE @result INTDECLARE @object INTPRINT 'Creating the CDONTS.NewMail object'EXEC @result = sp_OACreate 'CDONTS.NewMail', @object OUTPUTIF @result <> 0BEGIN PRINT 'sp_OACreate Failed' RETURN @resultENDPRINT 'Sending the message using the Send method'EXEC @result = sp_OAMethod @object, 'Send', NULL, @to, @from, @subject, @bodyIF @result <> 0BEGIN PRINT 'sp_OAMethod Failed' RETURN @resultENDPRINT 'Destroying the CDONTS.NewMail object'EXEC @result = sp_OADestroy @objectIF @result <> 0BEGIN PRINT 'sp_OADestroy Failed' RETURN @resultENDRETURN 0GO
"