title: SQL Replace() function on a select or variable
body: <pre><code>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 &lt;&gt; ''
  </code></pre>
  
  <p>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.</p>
  
  <p>What is the best way to do that?</p>