一次插入多条数据
--把一个表(或结果集)一次插入到数据库表中
insert into class(cname,cDescription)
select '01-2','01-21' union all
select '01-3','01-22' union all
select '01-4','01-23' union all
select '01-5','01-24' union all
select '01-6','01-25' union all
select '01-7','01-26'
把现有表的数据插入到新表(新表不能存在),该语句会自动创建一个和原有表结构
--要同的新表
--select * [into 新表名] from 表名 把数据找出来 --只能复制表的结果,数据类 约束没有复制过来
select * into Student_temp from Student where sage>=20
select * from Student_temp
delete from student_temp
drop table Student_temp
truncate table Student_temp
----把现有表的数据复制到一个已存在的表
set IDENTITY_INSERT Student_temp ON
insert into Student_temp (sId, sClassId, sName, sAge, sNo, sSex, sBirthday, sPhone)
select * from Student
set IDENTITY_INSERT Student_temp OFF