日期:2014-05-17 浏览次数:20513 次
create table #(bm varchar(20) not null) insert # select '12345|g' union all select '123456|ml' union all select '2345|支' union all select '5678910|tttt' ----请问如何替换"|"之前的数据,非常感谢!
SELECT 'a'+RIGHT(bm,LEN(bm)-CHARINDEX('|',bm)+1) FROM #
------解决方案--------------------
select REPLACE ( #a.bm , substring(#a.bm,1,charindex('|',#a.bm) - 1) , #b.mc ) from #a ,#b where #a.id=#b.id