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

求批量处理数据解决方案

2012-01-23 
求批量处理数据数据库SqlServer2000有两个表A,B两个表的ID相关联A的结构如下:idnameB的结构如下:idotherme

求批量处理数据
数据库Sql   Server   2000

有两个表A,B   两个表的ID相关联

A的结构如下:
id   name

B的结构如下:

id   othermessage

现在我要在A表中添加一个字段,该字段的值就是B表中id相关联的othermessage的值

sql   语句如何写?

[解决办法]
insert A表 select b.id,b.othermessage from A表 a ,B表 b where a.id = b.id
[解决办法]
alter table a
add othermessage varchar(1000)

update a
set
a.othermessage =b.othermessage
from a,b
where a.id=b.id
[解决办法]
lz 你是要增加数据还是更新数据啊?
[解决办法]
alter table a
add othermessage varchar(1000)

update a
set
a.othermessage =b.othermessage
from a left outer join b
on a.id=b.id

[解决办法]
alter table a add othermessage varchar(1000)

update a set a.othermessage =b.othermessage from a where a.id=b.id

热点排行