# Next number sequence is overwriting old ID after conversion

**URL:** <https://community.open-emr.org/t/next-number-sequence-is-overwriting-old-id-after-conversion/12534>\
**Category:** Data Analysis\
**Created:** [August 2, 2019, 1:59pm UTC](https://community.open-emr.org/t/next-number-sequence-is-overwriting-old-id-after-conversion/12534 "2019-08-02T13:59:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco](https://community.open-emr.org/user_avatar/community.open-emr.org/marco/32/12098_2.png) [@marco](https://community.open-emr.org/u/marco)\
**Post date:** [August 2, 2019, 1:59pm UTC](https://community.open-emr.org/t/next-number-sequence-is-overwriting-old-id-after-conversion/12534/1 "2019-08-02T13:59:54Z")

</div>

Can someone tell me where the “next numbers” for prescriptions and encounters are stored?  
After converting from V4.2 to V5.0.1 we are loosing data because of the “replace into” statement in prescriptions.  
See also attached document with screenshots.  
[ID issue after conversion OpenEMR.docx](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/c/c2ea28ee6a684fb10c1b1cfcd389118ab5cfad6d.docx) (175.0 KB)

Thanks in advance for the help.

---

<div class="post-metadata">

**Author:** ![marco](https://community.open-emr.org/user_avatar/community.open-emr.org/marco/32/12098_2.png) [@marco](https://community.open-emr.org/u/marco)\
**Post date:** [August 2, 2019, 2:16pm UTC](https://community.open-emr.org/t/next-number-sequence-is-overwriting-old-id-after-conversion/12534/2 "2019-08-02T14:16:23Z")

</div>

Sorry for this post, I already found the table “sequences”
