REPLACE function in stored procedure to update text field?
Posted on 2003-03-03
I get an error when I try to use the replace function on a text field:
Argument data type text is invalid for argument 1 of replace function.
I guess it only works for varchar etc so now I need to find a way to work around this. The application is a web based mailing list where users can enter text for the email message that is then personalised, such as "Dear [Firstname]". The error message above came from
SET Person_Message = REPLACE(Person_Message, '[Firstname]', Person_Firstname)
I wrote my first stored procedure ever yesterday so I don't know whether I'm heading in the right direction! If I end up having to loop through character by character (how?), do you have any idea how many rows I can do this on before everything grinds to a halt? The emails will be a few paragraphs at most (it's an invitation to take part in a survey) and there will be maybe 5000 recipients.
Any help much appreciated. TIA