MySQL: How do a i insert a specific number of blank rows into a table

nads

I want to grab a variable (between 1-365) and use this value to create the number of empty rows in a table:

insert into tblCustomer (ID) values (), (), ();

is there an easier way to do this or is using a loop the best way?

Any help would be appreciated.

Mihai

A procedure with an IN parameter is quite easy

 DELIMITER $$
 DROP PROCEDURE IF EXISTS test_loop$$
 CREATE PROCEDURE test_loop(IN number INT)
 BEGIN
 DECLARE x  INT(11);

 SET x = 1;    

 WHILE x  <= number  DO
 INSERT INTO tblCustomer(id)  VALUES('');
 SET  x = x + 1; 
 END WHILE;

 END$$
DELIMITER ;

How to use it

CALL test_loop(20);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MySQL: How do a i insert a specific number of blank rows into a table

From Dev

How do I return a specific number of rows (larger than 1), for each of the joined rows from the other table

From Dev

How do I insert data into mysql table?

From Dev

Insert data to mysql table ends up with blank rows?

From Dev

How i will stop specific keyword to insert into mysql table using php

From Dev

How do I insert multiple images in rows from mysql database?

From Dev

How do I modify this MySQL INSERT Query for multiple rows?

From Dev

How do I insert MergeField into specific table cell with VBA?

From Dev

How to check if new rows is insert in specific table

From Dev

How do I add rows in one table in specific conditions?

From Dev

How do I count the number of rows in a html table from java

From Dev

How do I do select specific rows in a table based on specific conditions in the table?

From Dev

How do I get the IDs of everybody with specific rows/values in MySQL

From Dev

How do I get number of results (rows) in MySQL?

From Dev

MYSQL how do i select always even number of rows in the LIMIT?

From Dev

MYSQL how do i select always even number of rows in the LIMIT?

From Dev

How do I insert rows if their values appear in a list but are not in the table and delete them if they do not appear in the list but are in the table?

From Dev

How to build a Table View with specific number of rows?

From Dev

How do I add millions of rows to a live production mysql table?

From Dev

How do I retrieve rows from mysql into a php/html table

From Dev

How do I add millions of rows to a live production mysql table?

From Dev

Loop PHP code to INSERT a specific number of unique rows to MySQL

From Dev

How do I remove the white blank in table?

From Dev

How do I find a table in MySQL with 2 specific columns in it

From Dev

How to create MySQL table with specific no. of rows?

From Dev

How do I select rows in an Sqlite table with a limit on the number of rows with a condition?

From Dev

Number of rows in a MySQL table?

From Dev

How can I add rows in my HTML table equal to the number of entries I have in Mysql DB?

From Dev

How do I split a single row into multiple rows and Insert into a table in Oracle?

Related Related

  1. 1

    MySQL: How do a i insert a specific number of blank rows into a table

  2. 2

    How do I return a specific number of rows (larger than 1), for each of the joined rows from the other table

  3. 3

    How do I insert data into mysql table?

  4. 4

    Insert data to mysql table ends up with blank rows?

  5. 5

    How i will stop specific keyword to insert into mysql table using php

  6. 6

    How do I insert multiple images in rows from mysql database?

  7. 7

    How do I modify this MySQL INSERT Query for multiple rows?

  8. 8

    How do I insert MergeField into specific table cell with VBA?

  9. 9

    How to check if new rows is insert in specific table

  10. 10

    How do I add rows in one table in specific conditions?

  11. 11

    How do I count the number of rows in a html table from java

  12. 12

    How do I do select specific rows in a table based on specific conditions in the table?

  13. 13

    How do I get the IDs of everybody with specific rows/values in MySQL

  14. 14

    How do I get number of results (rows) in MySQL?

  15. 15

    MYSQL how do i select always even number of rows in the LIMIT?

  16. 16

    MYSQL how do i select always even number of rows in the LIMIT?

  17. 17

    How do I insert rows if their values appear in a list but are not in the table and delete them if they do not appear in the list but are in the table?

  18. 18

    How to build a Table View with specific number of rows?

  19. 19

    How do I add millions of rows to a live production mysql table?

  20. 20

    How do I retrieve rows from mysql into a php/html table

  21. 21

    How do I add millions of rows to a live production mysql table?

  22. 22

    Loop PHP code to INSERT a specific number of unique rows to MySQL

  23. 23

    How do I remove the white blank in table?

  24. 24

    How do I find a table in MySQL with 2 specific columns in it

  25. 25

    How to create MySQL table with specific no. of rows?

  26. 26

    How do I select rows in an Sqlite table with a limit on the number of rows with a condition?

  27. 27

    Number of rows in a MySQL table?

  28. 28

    How can I add rows in my HTML table equal to the number of entries I have in Mysql DB?

  29. 29

    How do I split a single row into multiple rows and Insert into a table in Oracle?

HotTag

Archive