Skip to content

Instantly share code, notes, and snippets.

@savanovich
Created January 18, 2016 07:46
Show Gist options
  • Save savanovich/ba9eb904821df5306e59 to your computer and use it in GitHub Desktop.
Save savanovich/ba9eb904821df5306e59 to your computer and use it in GitHub Desktop.
Fill table with test data. Mysql procedure
DELIMITER $
CREATE PROCEDURE fill_test_table(x1 INT, x2 INT)
BEGIN
SET @x = x1;
REPEAT
INSERT INTO test_table SET id=@x, insert_time=UNIX_TIMESTAMP();
SET @x = @x + 1;
UNTIL @x > x2 END REPEAT;
END$
DELIMITER ;
CALL fill_test_table(1, 100); -- insert 100 rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment