要测试一下新功能,需要测试环境下的数据库有大量的数据,一个个插入显然不现实,需要了解一下存储过程
https://www.cnblogs.com/endtel/p/5407455.html
Navicat中左上角新建一个函数,选择过程
BEGIN DECLARE i int; DECLARE id int; set i=LAST_INSERT_ID(); SET id=1200; WHILE i<200 DO INSERT INTO app_server(id, appname, cname, serverIp, status, hostname, kernel, jdk, environment, server, serverType, intranet, dc, updateTime, createTime, version, appServerGroup, scope, diskInfo, jvmInfo, memorySize, ethernetInfo, cpuCores) VALUES(id, 'test-name', 'test-cname',CONCAT('t_5', i), 1, 'test-hostname', 'test-kernel', 'test-jdk', 'test-env', 'test-server', 'st-serverType', 0, 2, '2019-04-14 17:32:07', '2018-07-18 18:45:25', '2.3.3', 'test-appServerGroup', 'outer', '/:50G,/dev:16G,/dev/shm:16G,/run:16G,/sys/fs/cgroup:16G,/data:296G,/boot:497M,/home:48G', 'cp./jmxmon.jarcom.stephan.tof.jmxmon.JMXMonitor12', '00:03.0 Ethernet controller: Red Hat', 'Inc Virtio network device', 8); SET i=i+1; SET id=id+1; END WHILE; END
以上过程实现了插入200条记录