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

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

where col1 like '%测试%'

 

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

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

的错误

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

posted @ 2016-05-24 09:17  洋葱土豆随心匠  阅读(7727)  评论(0编辑  收藏  举报