㏈ª By β┖υΕJini/MS-SQL

Multiple Insert Rows

BLUEJINI.KR 2009. 10. 9. 16:50



Multiple Insert Rows

SQL Server 2008 supports the option of inserting multiple records in one statement. Each row of data is followed by a comma until reaching the last row where the INSERT command is completed like normal.


CREATE TABLE Customers
( CustID VARCHAR(20), CustName VARCHAR(20)
)





INSERT INTO Customers (CustID, CustName) VALUES ('Cust1', 'Smith Company'), ('Cust2', 'Perform Company'), ('Cust3', 'Test Inc');

Other version of SQL Server require a separate statement to be executed for each record insert.