sql中向表中同时添加多行记录

如题所述

楼上两位写的都是哦。
1楼写的是存储过程,
2楼写的是sql语句,其中2楼的sql中插入的记录是通过子查询查到的,这里要注意几点:第一就是要指明插入表的列,第二子查询中select必须指定列名,并且这两点涉及的列的个数要相等,列的属性要相同。
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-01-12
insert into table1 (id,name,value) select id,name,value from table2 where id>=20 and id<=50;
第2个回答  2011-01-12
begin
insert ..... ;
insert ....... ;
commit
end ;
相似回答
大家正在搜