第一種: insert into T1(id,name) values(1,'dd') 這種方式用于簡單插入幾條數(shù)據(jù),對于插入多條數(shù)據(jù)則很麻煩。 第二種: insert into T1 select filed... from T2 where ... 這種方式可以把另一個表的數(shù)據(jù)復(fù)制到T1中,必須完全按照T1表的字段來。也可以指定字段: insert into T1(id,name) select v1,v2 from T2 適合復(fù)制大量表數(shù)據(jù),如果有多個數(shù)據(jù)來源則用這種形式: select 1,'abc',100 union all select 2,'ccc',1200 第三種: select * into #temp from T1 把表T1的數(shù)據(jù)復(fù)制到臨時表#temp中,臨時表的表結(jié)構(gòu)會與T1完全相同, 使用完后 drop table #temp 刪除臨時表 |
|