用一条语句实现在表中插入n条相同记录,即现在想把一条记录复制n条
如 :insert into table1 select * from table1 where ?
例如复制tabel1中1点(时间)的记录,使 2点 ,3点 的内容和1点的内容相同
如 :insert into table1 select * from table1 where ?
例如复制tabel1中1点(时间)的记录,使 2点 ,3点 的内容和1点的内容相同
declare @nn int
while @nn<3
begin
insert into table1 (col1 ,col2 ,col3 ,time)
select col1 ,col2 ,col3,@nn from table1 where time=1;
set @nn=@nn+1;
end
insert into NEWtable select from oldTable