Sp_CopyTableToTable (procedure)
根据表名称将表数据拷贝到另一张表
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sTableName |
varchar(50) |
| 2 | IN | sSrcTableName |
varchar(50) |
| 3 | IN | sDbName |
varchar(50) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCopyTableToTable'._
Narrative
Business context: 系统平台 → 数据维护工具 — generic "copy one table's rows into another table" helper. Aligns the column lists by name (only the columns that exist in both sTableName and sSrcTableName under schema sDbName are copied), so it can mirror data across upgraded or branched tables without breaking on schema drift.
What it does: Counts columns of the target sTableName from information_schema.COLUMNS, opens a cursor over them, and for each column checks whether the same name exists on sSrcTableName; if so, appends it to p_sColumnsList. Then builds and PREPARE/EXECUTEs INSERT INTO sTableName(<list>) SELECT <list> FROM sSrcTableName. No filter, no transaction — full table copy.
Invocation: Status: appears orphaned. No gdsmodule hook, gdsconfigformmaster reference, or other-routine caller; xly-src only ships the install script script/标版/30100101/Sp_CopyTableToTable.sql. Generic data-tool intended to be called interactively during migrations/maintenance, not from runtime traffic.