SQL Replace () - Funktion auf eine select-oder-variable

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 <> ''

Möchte ich ersetzen Sie " [CallID]' in der Betreffzeile mit einem Wert. diese syntax nicht funktioniert.
Ich habe auch versucht, mit einer variable, wird nicht funktionieren, entweder.

Was ist der beste Weg, das zu tun?

InformationsquelleAutor Ezi | 2011-04-14
Schreibe einen Kommentar