-1

In SQL Server, these do the same thing essentially. What are the the pros/cons of doing it each way?

select * into table

vs.

insert into table select *

I'm looking for reasons such as performance, best practice, maintainability, etc.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Zee
  • 1,780
  • 3
  • 16
  • 27

2 Answers2

5

SELECT ... INTO mytable creates a new table. It fails if mytable already exists.

INSERT ... INTO mytable inserts into an existing table. It fails if mytable does not exist.

Quassnoi
  • 413,100
  • 91
  • 616
  • 614
2
SELECT * INTO TABLE

this inserts data into a new table

INSERT INTO TABLE SELECT *

copies the data from an existing table to another existing table

Matt Busche
  • 14,216
  • 5
  • 36
  • 61