Syntax for INSERT INTO vs SELECT INTO

One is commonly confused for the other….so ….

SELECT INTO inserts data into a new table and creates the new table on the fly (Table doesn’t exist) …


SELECT * INTO dbo.NewTableThatDoesntExist
from dbo.TableYouWantToCopyFrom

INSERT INTO inserts data into an existing table …


INSERT INTO dbo.NewTableThatAlreadyExists (Column1, Column2)
SELECT Column1, Column2
FROM dbo.TableYouWantToCopyFrom

Reference from Pinal Dave.

About AussieBICG

Connect with me here https://au.linkedin.com/in/aussiebicg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s