# Reset Customer Module

**URL:** <https://forum.litium.com/t/reset-customer-module/1745>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [November 6, 2020, 3:27pm UTC](https://forum.litium.com/t/reset-customer-module/1745 "2020-11-06T15:27:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victaxel](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/victaxel/32/159_2.png) [@victaxel](https://forum.litium.com/u/victaxel)\
**Post date:** [November 6, 2020, 3:27pm UTC](https://forum.litium.com/t/reset-customer-module/1745/1 "2020-11-06T15:27:31Z")

</div>

Hi,

An erp consultant asked me to remove all customers (persons) from a test site along with associated data like org links etc. Basically reset the customer module. They have a LOT of customers so manually doesn’t work.

I’m looking for a db script for this and would be grateful for one 🙂

Litium version: 7

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [November 9, 2020, 9:14am UTC](https://forum.litium.com/t/reset-customer-module/1745/2 "2020-11-09T09:14:09Z")

</div>

Something like this should do it:

```auto
DELETE FROM Security.PasswordLoginInfo WHERE NOT SystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonOrganizationLinkRoles WHERE NOT PersonSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonOrganizationLink WHERE NOT PersonSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonGroupLink WHERE NOT PersonSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonFieldData WHERE NOT OwnerSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonAddress WHERE NOT OwnerSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.Person WHERE NOT SystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')

```

The excluded GUIDs are for the system and everyone user.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [December 7, 2020, 9:14am UTC](https://forum.litium.com/t/reset-customer-module/1745/3 "2020-12-07T09:14:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
