SQL Server 'select * into' versus 'insert into ..select *

前端 未结 6 1853
刺人心
刺人心 2020-12-25 11:08

Say table1 and table2 already exist, is there any difference between these queries

query1 :-

select * into table1 from tabl         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-25 11:52

    In below query, table1 will be created or an error will be thrown if it already exists

    select * into table1 from table2 where 1=1
    

    In below query, the table table1 must exist before running the command

    insert into table1 select * from table2
    

提交回复
热议问题