# `Sp_initReserveCloumn` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sParentId` | `varchar(100)` |
| 2 | IN | `p_sMasterTableName` | `varchar(100)` |
| 3 | IN | `p_sMasterFirstCloumn` | `char(1)` |
| 4 | IN | `p_sMasterbm` | `varchar(100)` |
| 5 | IN | `p_sMasterRelationCloumn` | `varchar(100)` |
| 6 | IN | `p_sChinese2` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** 系统初始化 / 预留字段批量挂载 — generates the form-config rows (`gdsconfigformslave`) that expose a master table's "predefined reserve" columns (`sMReserve1..6`, `dMReserve1..3`, `iMReserve1..3`, `tMReserve1..2`) on a given child form. Caller passes the form-master parent id and a target table's first-letter / abbreviation; the proc emits one form-field row per reserve column with localised labels (`预留备注N`/`预留日期N`/etc.) prefixed by `p_sChinese2`.

**What it does:** Validates that the five `IN` params are non-empty (returns `'参数不能为空'` otherwise). For each of the four reserve groups it loops `@i` from 1 to N, builds the field-name as `<prefix>(t|s|d|i)<bm>Reserve<i>`, then executes a dynamic `INSERT INTO gdsconfigformslave(...)` populating ~45 columns (visibility, control type, default, color, format) per row. Pure DDL/metadata setup; no business-data effect at runtime.

**Invocation:** Status: appears orphaned. No `gdsmodule`/form-master/workflow/other-routine reference, no xly-src match. DBA tool, invoked manually when a new master/slave form needs the standard reserve-column set; verify before relying on it from new code.
