Different ways of inserting more than one record into a table

Method  1:   Using the Select INTO Statement

 

 

Syntax:

 

SELECT field1[, field2[, …]] INTO newtable [IN externaldatabase]     FROM source

 

 

 

Example 1:

 

Select * into StudentBackup from Student

 

Description:

The above example takes a backup of the entire Student table into another table named StudentBackup

 

 

Example 2:

 

Select colName1, colName2 into StudentsNew from StudentsOld where Course= 'Science'

Description:

The above example  retrieves two columns from the StudentsOld Table and inserts it into the StudentsNew table.

 

 

Method  2:   Using the Insert  INTO Statement

 

There is also another way to insert multiple records into a table from an existing table. Here it is.


Insert
INTO NewTable(colName1, colName2) Select colName1, colName2 from OldTable

This script inserts multiple rows from the table OldTable into NewTable