SQL - Alternative to REPLACE string on a text or ntext datatype

If your want to replace text in a TEXT or NTEXT datatype.. and your column is less than 4000 characters then you can use the below. UPDATE DynamicPages SET Content = CAST(REPLACE(CAST(Content as NVarchar(4000)),'XYZ','AAA') AS NText) WHERE Content LIKE '%XYZ%' But I would recommend the below query as some of the column's might be more than 4000 characters, FYI this will only work from SQL Server 2005+ UPDATE DynamicPages SET Content = CAST(REPLACE(CAST(Content as NVarchar(MAX)),'XYZ','AAA') AS NText) WHERE Content LIKE '%XYZ%'