sql去除某个字段中的某个字符串 replace

update A set
col1 =REPLACE ( col1 ,'测试' , '') 

where col1 like '%测试%'

在使用过程中如果遇到text类型的字段时会报 

参数数据类型 text 对于 replace 函数的参数无效

的错误

这时可以转换下字段类型  REPLACE ( cast(col1 as varchar(max)),'测试' , '') 

原文地址:https://www.cnblogs.com/yangcclg/p/5522272.html