>Yes, the value for the @iIPoId is set before the posted lines of code.
select @subject = cEmailSubject from webforms.dbo.lookup_emailTemplate where iEmailTemplateID = @iEmailTemplateID
SET @subject = REPLACE(@subject,'ltrim(rtrim(str(@iIpoId)))',convert(varchar(20),@iIpoId))
print @subject
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.