is there TRUNCATE in Access?

后端 未结 9 1474
滥情空心
滥情空心 2021-01-04 03:19

I have a table in an Access database with an autonumber field.

When I delete all the records from the table, the autonumber remembers the last number.

Does A

9条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 03:48

    In MS_Access Database, "Truncate is not supported". So we can delete the all records first by "Delete" query.

    After delete the records, we can alter the "ID" column starts from 1 by using "Alter" query.

    Query:

      "Delete * from (Your Table Name); 
      Alter Table (Your Table Name) Alter Column (Your Column Id) Counter(1,1);"
    

    Using this two queries in single execution we can delete all records and reset the column id starts from 1.

提交回复
热议问题