# `Sp_Del_AllTable_Data` (procedure)

> 清空所有表数据


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sType` | `varchar(255)` |
| 2 | OUT | `sReturn` | `varchar(4000)` |
| 3 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Del_AllTable_Data`'`._

## Narrative

**Business context:** Installation / data-purge tool — wipes every business and basic-data table in the tenant. Used when rebuilding a tenant from scratch (test / demo / fresh deployment); not part of any user-facing menu.

**What it does:** Validates that `sBrandNo` is not already present in `sysbrands` (aborts with `sBrandNoUnique` if it is, surfacing the message via `SP_Sis_GetConst`). Then `TRUNCATE`s the full set of cashier, customer, supplier, employee, machine, materials, process, product, sales, purchase, manufacturing, inventory, quality, finance, KPI and account-period tables — both basic-data (`ele*`, `sis*`, `sys*`) and transactional (`cah*`, `mft*`, `mit*`, `pit*`, `sal*`, `pur*`, `acc*`, `kpi*`, `qly*`, `out*`, `ops*`). Resets `hibernate_sequence` and tenant-scoped staging tables (`alltb`, `erpmerge*`).

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, no `gdsconfigformmaster` data-source, no other routine references it. xly-src ships `script/del/Sp_Del_AllTable_Data.sql` as part of the `script/del/` family; operators are expected to invoke it manually before re-seeding a tenant. Sibling of `Sp_Del_BasicsTable_Data` (basic-data only) and `Sp_Del_BusinessTable_Data` (transactional only).
