读书人

请问怎么更新非常感谢

发布时间: 2012-11-04 10:42:41 作者: rapoo

请教如何更新,非常感谢!

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 

读书人网 >SQL Server

热点推荐