例如:有一字段name
名字一
名字二
名字三
.
.
.如何把 "名字一" 修改为 "一"
也就是把 "名字" 两个字去掉
名字一
名字二
名字三
.
.
.如何把 "名字一" 修改为 "一"
也就是把 "名字" 两个字去掉
解决方案 »
- 求一个简单的时间比较问题
- 能自动创建一个表的语句该怎么写?
- 如何在同一个表中复制数据
- 建议将Analysis Services和Reporting Services部分放到MS-SQL Server版块
- 貌似没人会?
- 创建一个procedure在sql里运行提示:服务器 'SM' 没有为 DATA ACCESS 的目的而配置。应怎样解决?那位高手指点一下谢谢!
- sqlserver中有没有类似oracle的decode函数
- 这几天好象长分了。高兴啊。(弱水,zhuzhicao...)请进
- 请教vf问题:数值型转换成日期型的函数是哪个?如不能直接转换,应该怎样处理?很急!谢谢!
- [存储过程] 如何赋值
- 别名的用法
- 请教一个动态sql的问题
update tb set 字段=replace(字段,'名字','')
update 表A set name = replace(name,'名字','')
update tb set [name]=replace([name],'名字','')
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 col = replace(col , '名字' , '')
--只修改名字一
update tb set col = replace(col , '名字' , '') where col = '名字一'