Home » SELECT INTO SQL statement


The SELECT INTO SQL statement is used to select data from a SQL database table and to insert it to a different table at the same time without any use of temporary storage area.

The general SELECT INTO syntax looks like this:

SELECT Column1, Column2, Column3,
INTO Table2
FROM Table1

The list of column names after the “SELECT” command determines which columns will be copied, and the table name after the “INTO” keyword specifies to which table to copy those rows.

If we want to make an exact copy of the data in our Persons table, we can use the following SELECT INTO statement:

INTO Persons_Date
FROM Persons

Using Select * into statement does not copy indexes on primary table. If you need indexes to created on copied table, Script out the existing indexes and change table name to new one to create them on new table.

Leave a Reply

Your email address will not be published.