sql2000的sql语句的update是修改表的数据,有没有在原有数据后增加数据的语句??请举例说明!!谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/10 12:07:50
sql2000的sql语句的update是修改表的数据,有没有在原有数据后增加数据的语句??请举例说明!!谢谢
如果A表有下列数据
id name
1 张三
2 李四
3 王五
现在的要求是把id=3的人的名字后加上王六
id name
1 张三
2 李四
3 王五王六
不用update A set name='王五王六' where id=3
我想直接在王五后边加王六
怎么写???

create table t(col nvarchar(100))

insert t select 'old'

update t set col=col+' new'

如果A表有下列数据
id name
1 张三
2 李四
3 王五
现在的要求是把id=3的人的名字后加上王六
id name
1 张三
2 李四
3 王五王六

update A
set Name=Name+'王六'
where Name='王五'
--or
update A set Name=replace(Name,'王五','王五王六')

update是修改已存在表的数据
如果A表有下列数据
id name
1 张三
2 李四
3 王五
现在的要求是把id=3的人的名字改为赵六
则运行如下语句
update A set name='赵六' where id=3

update 表名 set 变量名=变量名+新增数据 where 条件

update A set name='王五王六' where name='王五'

update A set name=concat(name,'王六') where id = 3;

这个经过试验的,通过测试