1,str_replace(字段,被替换字符,替换字符)
Sybase数据库中对某个字段部分替换的SQL语句
在Sql Server中如果想对某个数据表table1的Email字段所有的值中的比如“@”替换成“#”,可以使用如下Sql语句:
update table1 set Email=replace(Email,'@','#') where Email like '%@%'
如果在Sybase中数据库实现这个操作就需要用str_replace而不是replace了。上面那个需求在Sybase中实现构造的Sql语句如下:
update table1 set Email=str_replace(Email,'@','#') where Email like '%@%'