我有一张User表里面有个name字段如下
key name
1 abc/herb
2 abc/kevin
3
4 abc/tracy
5
6 abc/peter
现在name字段里的值都多了“abc/”,我想用一句sql语句将“abc/”去掉,v如下:
key name
1 herb
2 kevin
3
4 tracy
5
6 peter
请问这个语句怎么写?
------解决方案--------------------
select key,replace(name, 'abc/ ', ' ') as name from user
------解决方案--------------------
update user set name=replace(name, 'abc/ ', ' ')
------解决方案--------------------
select key,name = stuff(name,1,4, ' ') from User
------解决方案--------------------
select key,substring(name,4,100) from t
------解决方案--------------------
select key,substring(name,5,100) from t