How to insert same record multiple times in Mysql using single query and not using for loop.
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,
Your question doesn't really make any sense. Why don't you want to use a for loop ? You can always issue 10+ same statements to do your insert, but then what's the point to do it this way ?
No memory stick has been harmed during establishment of this signature.
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,
with out knowing what you code is like and how you are inserting your data have you considered a union statement? MySQL Union[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
Your question doesn't really make any sense. Why don't you want to use a for loop ? You can always issue 10+ same statements to do your insert, but then what's the point to do it this way ?
No memory stick has been harmed during establishment of this signature.
in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,
It sounds like your database is in serious need of normalization.
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,
MySql Insert documentation[^] As far as I can see you will need to use a loop of some kind, can I ask why you want to do it with no looping? you could easily do it simply like this in psuedo code
Open Database Connection
For i = 1 to 50
Insert into Datbase table the values
i++
next
Close DatabaseAs others have said you may need to reconsider your database design.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
MySql Insert documentation[^] As far as I can see you will need to use a loop of some kind, can I ask why you want to do it with no looping? you could easily do it simply like this in psuedo code
Open Database Connection
For i = 1 to 50
Insert into Datbase table the values
i++
next
Close DatabaseAs others have said you may need to reconsider your database design.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
by using for loop i can but is there any possibility to write a single Mysql query to insert 50 or more records. In Sybase they are using GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records.
The only way I could see you doing that in MySql is to do something like the following but I believe that it will be unmanageable and to be honest I personally only use this approach when I am trying to knock up some dirty data for R&D or testing never used it in a live system
insert into numbers (MyNumber)
select 1
union
select 2
union
select 3
union
select 4Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,
According to the MySQL documentation:
INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas. Example:
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
-
Hi I created one web form and i need to insert all same record more than 10 times using Mysql query. How to insert same record multiple times in Mysql using single query and not using for loop. If anybody knows, please reply me. one more thing in Sybase some people sujjesting to go for GO command like insert into tablename(columnname) values('abc') go 50 it wil insert 50 records like this is there any chance to write Mysql query to insert 50 records using Go command like that, i tried but it is not working Thanking you,