请教如何更新,非常感谢!
- SQL code
create table #(bm varchar(20) not null)insert #select '12345|g'union allselect '123456|ml'union allselect '2345|支'union allselect '5678910|tttt'----请问如何替换"|"之前的数据,非常感谢!
[解决办法]
- SQL code
SELECT 'a'+RIGHT(bm,LEN(bm)-CHARINDEX('|',bm)+1) FROM #
[解决办法]
- SQL code
select REPLACE ( #a.bm , substring(#a.bm,1,charindex('|',#a.bm) - 1) , #b.mc ) from #a ,#b where #a.id=#b.id