[Solved] Inserting a multiple records in a table with while loop [closed]


Your current syntax problem is with the @count = @count + 1; which needs to be set @count = @count + 1.

But…

There is no need for a loop. You can simply do one big insert directly, like:

insert into your_table (fk_col, other_col1, other_col2)
select pk_col, 'something', 'something else' 
from your_other_table

If you need to, you can add a where clause to the above.

6

solved Inserting a multiple records in a table with while loop [closed]