楼主好,使用SQL中的Replace函数,即可达到要求.比如现在某一列A中有个字符串:aabbcdeef,假设要把字符串当中的e替换成g,则:select replace(A,'e','g') from table1
用replace啊replace(str,from_str,to_str)在字符串 str 中所有出现的字符串 from_str 均被 to_str替换,然后返回这个字符串
S_VData 这个字段是ntext 类型的不能用right,left取改成用substring 应该可以 ----------如果S_VData 不会超过4000的话可以这样UPDATE S_Video SET S_VData=RIGHT(convert(Nvarchar(4000),S_VData),LEN(convert(Nvarchar(4000),S_VData))-1) WHERE S_VData LIKE '%#'
update table set LocID=stuff(LocID,1,4,'0001') where left(LocID,4)='0004'
select substring(name,4,len(name)-3) from data你可以试下上面语句substring是sql中获取子字符串的函数len反回一个字段的长度上面语句结果应该是去掉name字段前三个字符
用这个语句吧select * from 表名 where left(字段名,2)='11'left的意思从左边开始取几个字符希望能帮到你
如果是在windows系统中,打开该sql文件 ,ctrl+h打开查找替换功能,输入你要查找和所要替换的内容,全部替换即可.如果是在linux/unix系统中,则需要用字符管理命令sed来批量替换.
以 AxxxxA 为例,把替换其中第二个A为B,保留第一个 使用时,把'AxxxxA替换成你的列名就可以了. select left('AxxxxA',CharIndex('A','AxxxxA'))+ replace(right('AxxxxA',len('AxxxxA')-CharIndex('A','AxxxxA')),'A','B') ------ ------------------- 如果经常用
select replace ( ''123456'' , ''456'' , ''546'' ) from table
update tab1 set name=replace(name,'abc','d') where name like 'abc%'