34,590
社区成员
发帖
与我相关
我的任务
分享
declare @table table (name varchar(6))
insert into @table
select '名字一' union all
select '名字二' union all
select '名字三'
--如果名字2个字是固定的
update @table
set name=replace(name,'名字','')
select * from @table
/*
name
------
一
二
三
*/
declare @table1 table (name varchar(6))
insert into @table1
select '名字一' union all
select '名字二' union all
select '名字三'
--如果2个字是不固定的,但是长度固定
update @table1
set name=substring(name,3,len(name))
select * from @table1
/*
name
------
一
二
三
*/
update tb set [name]=replace([name],'名字','')
update 表A set name = Stuff(name,1,2,'')
update 表A set name = replace(name,'名字','')
update tb set 字段=replace(字段,'名字','')