Insert multiple rows using one insert statement in Access 2010

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

    MS Access does not allow multiple insert from same sql window. If you want to insert, say 10 rows in table, say movie (mid, mname, mdirector,....), you would need to open the sql windows,

    1. type the 1st stmt, execute 1st stmt, delete 1st stmt
    2. type the 2nd stmt, execute 2nd stmt, delete 2nd stmt
    3. type the 3rd stmt, execute 3rd stmt, delete 3rd stmt ......

    Very boring. Instead you could import the lines from excel by doing:

    1. Right-click on the table name that you have already created
    2. Import from Excel (Import dialog box is opened)
    3. Browse to the excel file containing the records to be imported in the table
    4. Click on "Append a copy of the records to the table:"
    5. Select the required table (in this example movie)
    6. Click on "OK"
    7. Select the worksheet that contains the data in the spreadsheet
    8. Click on Finish

    The whole dataset in the excel has been loaded in the table "MOVIE"

提交回复
热议问题