随机数函数
RAND()* 1021120 INTO v;
编写存储过程
DELIMITER; DROP PROCEDURE IF EXISTS test_insert; CREATE PROCEDURE test_insert () BEGIN DECLARE i INT DEFAULT 1; DECLARE v INT DEFAULT 1; WHILE i <= 1000 DO SELECT RAND()* 1021120 INTO v; INSERT INTO `test` VALUES (v, 0, ' ', 'test', '2021-04-01 09:59:53', '2000-01-01 00:00:01', 'litaolitao', '2021-04-01 10:00:13', 2); SET i = i + 1; END WHILE; END;
调用存储过程
CALL test_insert();
标签: #insert
评论列表