SQL Server 'select * into' 与 'insert into ..select * [英] SQL Server 'select * into' versus 'insert into ..select *
本文介绍了SQL Server 'select * into' 与 'insert into ..select *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
说table1
和table2
已经存在,这两个查询有什么区别吗
Say table1
and table2
already exist, is there any difference between these queries
查询 1 :-
select * into table1 from table2 where 1=1
查询2:-
insert into table1 select * from table2
推荐答案
select * into table1 from table2 where 1=1
创建 table1 并将 table2 的值插入其中.因此,如果该表已经创建,该语句会出错.
The select * into table1 from table2 where 1=1
creates table1 and inserts the values of table2 in them. So, if the table is already created that statement would give an error.
insert into table1 select * from table2
只将table2的值插入到table1中.
The insert into table1 select * from table2
only inserts the values of table2 in table1.
这篇关于SQL Server 'select * into' 与 'insert into ..select *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文