I have an html string stored as a record:
<div>
<p>##RecipientFirstName##,</p>
<p>##CustomerProjectOwnerName## with ##CustomerName## has approved your...</p> </div>
I want to replace the items inside the hash tags with actual names stored in the person table. I have tried this but it returns 3 different records. I need one record returned with the items inside the hash tags replaced with the Replace statement. My code:
SELECT mtg.Template, REPLACE(mtg.Template, '##RecipientFirstName##',(SELECT p.FirstName FROM dbo.Person p WHERE p.PersonId = 16)) ,
REPLACE(mtg.Template, '##CustomerProjectOwnerName##',(SELECT p.FirstName FROM dbo.Person p WHERE p.PersonId = 16))
FROM dbo.MessageTypeGlobal mtg
WHERE mtg.MessageTypeGlobalId = 1