Inserting multiple rows into a table using a single INSERT statement

user1408672 picture user1408672 · May 24, 2012 · Viewed 41.1k times · Source

I have no idea why I cannot insert values into my table using this syntax. I can insert one row but I cannot insert multiple rows.

CREATE TABLE T1 (
             ID BIGINT NULL,
             CAT VARCHAR(255) NULL,
             M_ID BIGINT NULL,
             T_CAT  VARCHAR(255) NULL,
             NUM BIGINT NULL) 

    INSERT INTO T1
    VALUES
    (32,'Math',945,'Red',2),
    (6,'English',232,'Blue',2)

Answer

Stefan picture Stefan · May 24, 2012

Your syntax is correct. However, inserting multiple rows is a SQL-92 feature. Seems like your database doesn't support it.