Sql Server REPLACE函数的使用

REPLACE 更新替换数据库某个字段的的部分的值,比如替换数据库中url字段的域名,

语法:REPLACE ( ''cloum'' , ''string_old'' , ''string_old'' )

参数
''cloum''

待替换字段的字符串表达式。

''string_old''

待查找的字符串表达式。

''string_old''

替换用的字符串表达式。

示列:将表 table_name中url字段里的'http://www.baidu.com替换成http:/www.google.com

UPDATE table_name set URL=replace(URL,'http://www.baidu.com','http:/www.google.com') where 1=1;

 

posted @ 2017-09-21 14:46  柠檬味的橘子皮  阅读(1818)  评论(0编辑  收藏  举报