Insert multiple rows using one insert statement in Access 2010

后端 未结 8 501
醉酒成梦
醉酒成梦 2020-12-17 22:19

I want to insert multiple values into an Access 2010 table, but I can\'t seem to find a way.
MySQL had a nice way:

INSERT INTO Production.UnitMeasure
VAL         


        
8条回答
  •  温柔的废话
    2020-12-17 23:18

    Create a table called OneRow with a single integer column. Insert one row.

    Then:

    INSERT INTO Production.UnitMeasure
    SELECT 'FT2', 'Square Feet ', '20080923' FROM OneRow
    UNION ALL SELECT 'Y', 'Yards', '20080923' FROM OneRow
    UNION ALL SELECT 'Y3', 'Cubic Yards', '20080923' FROM OneRow
    

    Your exact syntax works on SQL Server 2008. For earlier use my above query without the FROM clauses and no helper table.

提交回复
热议问题