【发布时间】:2016-05-05 16:51:32
【问题描述】:
我有 HeidiSQL,我有一个 3MB 的查询需要运行,但我想用随机数替换某些文本/值。我该怎么做?
我需要替换它,因为有很多行。
INSERT INTO creature (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `PhaseId`, `PhaseGroup`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `VerifiedBuild`) VALUES
('@CGUID+0', 83855, 1116, 0, 0, 3, '0', 0, 0, 0, 1504.222, -2147.853, 90.73972, 0.6455684, 7200, 10, 0, 0, 0, 1, 0, 0, 0, 21463), -- 83855 (Area: 7120) (possible waypoints or random movement)
('@CGUID+1', 81244, 1116, 0, 0, 3, '0', 0, 0, 0, 1514.845, -2106.458, 92.60474, 2.908402, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 21463), -- 81244 (Area: 7120) (Auras: 163908 - 163908)
('@CGUID+2', 81244, 1116, 0, 0, 3, '0', 0, 0, 0, 1484.29, -2122.714, 92.58028, 1.293478, 7200, 0, 0, 0, 0, 0, 0, 0, 0, 21463), -- 81244 (Area: 7120) (Auras: 163908 - 163908)
所以基本上我想替换 @CGUID+ 所在的位置并添加一个随机数(最好在 1-999999 之间)。因此,它会添加到当前数字上,如下所示:
'4820940' '2850331' '2854962'
请注意,每个最后一位数字都没有改变,它只是被替换的第一个文本。但我需要它是随机的。
【问题讨论】:
-
只是为了确认:您需要这样做是因为您需要打乱数据?
-
另外,由于 HeidiSQL 只是一个工具,请问您正在分析/管理哪个数据库:MySQL、SQLServer 或 Postgres?
-
@Chris 欢迎来到 SO。当您发布时,您需要向我们提供更多信息。您的查询是什么样的?您要访问什么数据库?你已经尝试过什么?