昨天做修改操作时用到了replace函数

--备份表
create table ac01_20150105 as select * from ac01;
create table ac01_dy_20150105 as select * from ac01_dy;
create table cjscrz_20150105 as select * from cjscrz;




--更新基本信息
update ac01 t set t.yhmc = replace(t.yhmc,'95580','96288') where t.photo_path like '%82_SBK_3_41100023_6000_20141225_4%' and t.yhmc = '95580';
update ac01_dy t set t.yhmc = replace(t.yhmc,'95580','96288') where t.photo_path like '%82_SBK_3_41100023_6000_20141225_4%' and t.yhmc = '95580';

--更新采集上传日志
update cjscrz t set t.yl1 = replace(t.yl1,'95580','96288') where t.scpc like '%82_SBK_3_41100023_6000_20141225_4%' and t.yl1 like '%95580%'; 

replace函数

用第三个表达式替换第一个字符串表达式中出现的所有第二个给定字符串表达式。

语法

REPLACE ( 'string_expression1' , 'string_expression2' , 'string_expression3' )

参数

'string_expression1'

待搜索的字符串表达式。string_expression1 可以是字符数据或二进制数据。

'string_expression2'

待查找的字符串表达式。string_expression2 可以是字符数据或二进制数据。

'string_expression3'

替换用的字符串表达式。string_expression3 可以是字符数据或二进制数据。

返回类型

如果 string_expression(1、2 或 3)是支持的字符数据类型之一,则返回字符数据。如果 string_expression(1、2 或 3)是支持的 binary 数据类型之一,则返回二进制数据。

posted on 2015-01-06 10:46  BUG易  阅读(994)  评论(0编辑  收藏  举报