You get this error because you have a text data type. With the varchar data type, your request works fine.
To use the replace function, you need to specify your field with text to varchar .
Declare @mytable table ( Article text ); INSERT into @mytable VALUES('<p> </p>'); INSERT into @mytable VALUES('<p> </p>'); INSERT into @mytable VALUES('<p> </p>'); INSERT into @mytable VALUES('<b> </b>'); select replace(cast([article] as VARCHAR(8000)),'<p> </p>','') from @mytable where Article LIKE '<p> </p>'
source share