insert into s values(sno,sn,sex, age ,dept,constraint )
select 's1','litao','boy','19','xinxi' union
select 's12','litao2','boy2','192','xinxi2' union
写个存储过程就可以了。
insert into xx (field1,field2) select x from table2;
select into 也可以批量.
帖子3923 精华128 积分209640 阅读权限200 性别男 在线时间1096 小时 注册时间2007-10-23 最后登录2008-7-24 查看详细资料TOP
set @sql=@#bcp "@#+@tbname
+case when @isout=1 then @#" out@# else @#" in@# end
+@# "@#+@filename+@#" /c@# +@# /S"@#+@servername
+case when isnull(@username,@#@#)=@#@# then @#@#
else @#" /U"@#+@username end
+@#" /P"@#+isnull(@password,@#@#)+@#"@#
+@# /t"@#+@fdsplit+@#"@#
+@# /r"@#+@rowsplit+@#"@#
================================
/*
use student
create table s
(
sno char(10) not null primary key,
sn varchar(20) not null ,
sex char(8) not null check (sex in ('boy','girl')),
age int not null check (age>0),
dept varchar(30),
constraint sn_u unique(sn)
)
================表
s1 李涛 boy 19 信息
s2 王林 girl 18 计算机
s3 陈高 girl 21 自动化
s4 张杰 boy 17 自动化
s5 吴小莉 girl 19 信息
s6 徐敏敏 girl 20 计算机
*/
insert into s (sno,sn,sex,age,dept)
select 's1','李涛','boy',19,'信息' union
select 's2','王林','girl',18,'计算机' union
select 's3','陈高','girl',18,'自动化' union
select 's4','张杰','boy',17,'自动化' union
select 's5','吴小莉','girl',19,'信息' union
select 's6','徐敏敏','girl',20,'计算机'