# `Sp_BatchGetSid` (procedure)

> 批量获取id


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iCount` | `int` |
| 2 | OUT | `sReturn` | `varchar(4000)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 条码(随机码)生成 → 条码管理 → 材料库存 — bulk id-allocator used by the 随机码 (random-code) barcode generation form to pre-mint `iCount` fresh `newId()` values for batch-printing a barcode roll.

**What it does:** Defaults `iCount` to 20 when 0/null. Creates temp table `p_TmpTable(sId)`, loops `iCount` times inserting `newid()` into it, `SELECT * FROM p_TmpTable` (rowset back to caller), then drops the temp table.

**Invocation:** Embedded in `gdsconfigformmaster` form `16050651010009472619904464080000` (条码(随机码)生成) under module `16483507160005496961716614988000` (条码管理). Also defined as a procedure-install script at `xly-src/script/标版/30100101/Sp_BatchGetSid.sql`. No Java caller or other procedure references this name.
