How is the sales_flat_order.entity_id determined and is there a safe way for me to start it at a higher number?

We just changed versions of magento and have an external ERP. Becuase the orders are created using entity_id we are getting duplicate order issues. I would like to start entity_id where the last site left off?

1 Answer 1


This information is stored in eav_entity_store and can be edited there.

To change the entity_id you need to change the AUTO_INCREMENT value of a database, this can be done via a SQL query:

ALTER TABLE `sales_flat_order` AUTO_INCREMENT = 5;

On a short search through the magento codebase and Varien_Ddl and Pdo stuff I didn't found anything to do it via a method.

  • Hmm I'm using 1.8 and it's not there. I'm not looking for 'increment_last_id' but am looking for 'entity_id'.
    – willboudle
    May 30, 2014 at 15:43
  • oh, sorry. Updated. May 30, 2014 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.