首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

请问怎么更新,非常感谢

2012-11-04 
请教如何更新,非常感谢!SQL codecreate table #(bm varchar(20) not null)insert #select12345|gunion a

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

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 

热点排行