注册 登录
编程论坛 SQL Server论坛

[求助]如何用INSERT语句插入多个元组

crz03128 发布于 2007-10-11 09:36, 6941 次点击
只知道插入一个元组的方法如

insert
into Student (Sno,sname,ssex,sdept,sage)
values('200215128','陈冬','男','IS','18');

但如何插入多条记录呢,请帮忙
5 回复
#2
sky_yang_sky2007-10-11 09:39
insert into student(sno,sname,ssex,sdept,sage) select fields from table
or
insert into student(sno,sname,ssex,sdept,sage)
select '200215128','陈冬','男','IS','18'
union all
select '200215129','陈冬','男','IS','18'
......

[此贴子已经被作者于2007-10-11 9:43:07编辑过]

#3
crz031282007-10-11 09:43

谢谢 谢谢
但能否再详细点

#4
Kendy1234562007-10-11 10:03
insert into table1 (f1,f2,f3,f4)
select f1,f2,f3,f4 from table2 where f5 > 0
#5
dingpin2007-10-14 20:25
insert into Student (Sno,sname,ssex,sdept,sage)
select '200215128','陈冬','男','IS','18' union all
select '200215128','陈冬','男','IS','18' union all
select '200215128','陈冬','男','IS','18' union all
select '200215128','陈冬','男','IS','18' union all
select '200215128','陈冬','男','IS','18' union all
select '200215128','陈冬','男','IS','18'

当然插入的每个值是不同的,你改吧!!!
#6
songyang2012007-10-14 23:19
呵呵 够详细的了...
1