从查询结果中,批量写入到表中
SELECT INTO FROM创建表并复制表数据
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->???--1.创建测试表
????create?TABLE?Table1
????(
????????a?varchar(10),
????????b?varchar(10),
????????c?varchar(10),
????????CONSTRAINT?[PK_Table1]?PRIMARY?KEY?CLUSTERED
????????(
????????????a?ASC
????????)
????)?ON?[PRIMARY]
????GO
????--2.创建测试数据
????Insert?into?Table1?values('赵','asds','90')
????Insert?into?Table1?values('钱','asds','100')
????Insert?into?Table1?values('孙','asds','80')
????Insert?into?Table1?values('李','asds',null)
????GO
????--3.SELECT?INTO?FROM语句创建表Table2并复制数据
????select?a,c?INTO?Table2?from?Table1
????GO
????--4.显示更新后的结果
????select?*?from?Table2
????GO
????--5.删除测试表
????drop?TABLE?Table1
????drop?TABLE?Table2
?
?
?
============================
--批量加组员工
insert into groupmember(id, groupid, staffid, status, creatorid, createdtime, delflag)
select sys_guid(), 'YG_007', staff_id,? 1, 'admin', '2013-03-20 17:05:32', 'n' from staff;