INSERT INTO portal.dbo.r_EmailsScheduled
([emailaddress]
,[subject]
,[messageTypeID]
,[sent]
,[html]
,[dealid])
SELECT
@toEmail
,@subject
,@eventTypeID
,'False'
,replace(Replace(Replace(@emailTemplate,'_dealID',@id1),'_refname', @refName),'_refdate',@refDate)
,@id1
WHERE (portal.dbo.r_EmailsScheduled.dealid <> @id1 and portal.dbo.r_EmailsScheduled.messageTypeID <> @eventTypeID)
|