您的位置: 首页好东西编程开发 → 函数replace 的参数的数据类型 text 无效

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

我要评论 2015/06/30 00:00:00来源:互联网 编辑:当易小编 [ ] 评论:0 点击:284次

最近在用replace语句修改数据库的时候,遇到"函数 replace 的参数的数据类型 text 无效。"的错误提示,从网上查了一下:replace替换字段为text或者ntext时,必须转换类型后才能替

换,如要替换字段类型为text的news_content内容,则需要写成如下格式:

update news_info set
news_content=replace(cast(news_content as varchar(8000)),'/uploadfile/','/newsImages/')

关键词:sql