1.批量插入数据
GO
if object_id('cs_2')is not null
drop table cs_2
GO
create table cs_2
(
顾客编号 varchar(30) not null,
顾客姓名 varchar(30) not null,
联系方式 varchar(30) not null,
所在城市 varchar(50)
)
insert into cs_2
select '1','2','3','4'union all
select '11','21','31','41'union all
select '111','211','311','411'
select * from cs_2
2.批量从别的表插入新表数据
GO
if object_id('cs_3')is not null
drop table cs_3
GO
create table cs_3
(
顾客编号 varchar(30) not null,
顾客姓名 varchar(30) not null,
联系方式 varchar(30) not null,
所在城市 varchar(50)
)
insert into cs_3
select * from cs_2 where 顾客编号='1'
select * from cs_3
3.还有就是前面有一节说的,批量插入数据!
批量数据操作与表间数据迁移
本文介绍了SQL中批量插入数据的方法,并演示了如何从一个表中选择数据到另一个表,实现数据的有效迁移。
196

被折叠的 条评论
为什么被折叠?



