第1个回答 2009-11-17
insert into tableA (col1,col2, col3)
(
select tableB.col1, tableB.col2, tableB.col3
from tableB
where ...
)
第2个回答 2009-11-17
insert into T_annual(year,userid,username) select hryear,userid,username from T_annualleavebase where ...
第3个回答 2017-03-02
以下:
1、
insert into A([id], ids, [name], type, time)
select [id], null, [name], 'dd', getdate() from B where type='dd'
2、
DECLARE @num int,@i int;
SET @i=0;
SET @num=(select 字段 from 表1 where 条件);
WHILE @i<@num
begin
set @i=@i+1;
insert INTO 表2(字段) SELECT 字段 from 表1 where 条件;
end;
3、
insert into b (column1,datecolumn)
select column1,getdate() from a