inserting multiple rows with one insert command

后端 未结 5 1629
不思量自难忘°
不思量自难忘° 2020-12-07 02:25

Is it possible to insert more than one row in a table with one insert statement? I know this will happen if I do:

insert into table ( fields ) select values          


        
5条回答
  •  难免孤独
    2020-12-07 03:19

    INSERT INTO College (CustomerID, FirstName, MiddleName, LastName)
    
    SELECT 7, N'Charles', N'Simmons', N'Burns'
    UNION ALL
    SELECT 9, N'Dominic', N'Fred', N'Einsten'
    UNION ALL
    SELECT 12, N'Dave', N'William, N'Bryan';
    

    NOTE: Letter N before each hard coded string value converts string to an NVARCHAR value to match the datatype of the column.

提交回复
热议问题