Insert multiple rows into single column

前端 未结 9 1722
抹茶落季
抹茶落季 2020-12-24 07:29

I\'m new to SQL, (using SQL 2008 R2) and I am having trouble inserting multiple rows into a single column.

I have a table named Data and this is what I

9条回答
  •  情书的邮戳
    2020-12-24 07:56

    If your DBMS supports the notation, you need a separate set of parentheses for each row:

    INSERT INTO Data(Col1) VALUES ('Hello'), ('World');
    

    The cross-referenced question shows examples for inserting into two columns.

    Alternatively, every SQL DBMS supports the notation using separate statements, one for each row to be inserted:

    INSERT INTO Data (Col1) VALUES ('Hello');
    INSERT INTO Data (Col1) VALUES ('World');
    

提交回复
热议问题