insert into tba(a,b,c) select c,d,e from tbb where ...
insert into @b select * from @a
INSERT TB SELECT 1 ,3 UNION ALL SELECT 2 ,2 UNION ALL select 3 ,5
--从其他表 批量数据过来 insert 表 select * from 数据表
insert into table 结果集
declare @table1 table(id int) insert into @table1 select 1 union all select 2 union all select 3 union all select 3 select * from @table1id ----------- 1 2 3 3(4 行受影响) 如果是union select 则会自动去掉重复declare @table1 table(id int) insert into @table1 select 1 union select 2 union select 3 union select 3 select * from @table1
SELECT 1 UNION ALL
SELECT 2 ....
select c,d,e from tbb where ...
insert into @b select * from @a
SELECT 1 ,3 UNION ALL
SELECT 2 ,2 UNION ALL
select 3 ,5
insert 表
select * from 数据表
insert into table
结果集
insert into @table1 select
1 union all select
2 union all select
3 union all select
3
select * from @table1id
-----------
1
2
3
3(4 行受影响)
如果是union select 则会自动去掉重复declare @table1 table(id int)
insert into @table1 select
1 union select
2 union select
3 union select
3
select * from @table1
id
-----------
1
2
3(3 行受影响)