INSERT [TOP (<expression>) [PERCENT] [into] <tabular object>
[(column list)]
[OUTPUT <output Clause>]
{VALUES (<data values>) [, (<data values>)] [,... N]
| <table source>
| EXEC <procedure>
| DEFAULT VALUES
This structure looks like a crash, more basic as follows:
INSERT [into] <table>
[(column list)]
VALUES (<data values>) [, (<data values >)] [,...-N]
MultiRow Insert, as long as the price in the following comma "," You can write a column of values
INSERT into Table
(ID,NAME,PWD)
VALUES
(1, Zhang San, 123),
(2, John Doe, 124)
Inserting multiple data at once can reduce the number of round trips to the server and improve performance.
INSERT into ... SELECT statement
Use AdventureWorks2012;
DECLARE @MyTable Table
(
SalesOrderID int,
CustomerID Char (5)
);
INSERT into @MyTable
SELECT SalesOrderID, CustomerID
From AdventureWorks2012.Sales.SalesOrderHeader
WHERE SalesOrderID between 44000 and 44010;
SELECT *
From @MyTable;
Methods of using temporary tables. Temporary table variables exist only in the batch process.
SQL SERVER 2012 Chapter III using INSERT statements to add data