insert into PendingEmails (Subject,Body,ToEmail,PendingEmailStatusID)
select REPLACE( select subject from dbo.EmailTemplates where ID = 7 ), '[CallID]'), (select Body from dbo.EmailTemplates where ID = 7) ,contact.Email ,5
FROM inserted AS i inner join Calls on i.CallID = Calls.CallId inner join Contact on calls.ContactID = Contact.ContactID
where contact.Email is not null and contact.Email <> ''
I want to replace '[CallID]' in the subject with a value. that syntax is not working. I also tried using a variable, wont work either.
What is the best way to do that?