Insert multiple rows using one insert statement in Access 2010

后端 未结 8 517
醉酒成梦
醉酒成梦 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:11

    As marc_s has pointed out, for SQL Server 2008 and later, you can just use table value constructors. For previous versions, you can use insert and select...union all, e.g.:

    INSERT INTO Production.UnitMeasure
    SELECT N'FT2',N'Square Feet ','20080923' union all
    SELECT N'Y',  N'Yards',       '20080923' union all
    SELECT N'Y3', N'Cubic Yards', '20080923'
    

    (Specific documentation on Table Value Constructors in SQL Server. I can't find specific separate documentation on row value constructors, but that's what they are)

提交回复
热议问题