0

Hi all. I come from an MS SQL background and a newbie in MY SQL. Im trying to run a simple query to populate a table:

Declare @I As Int
     
Select @I = 1 

While (@I < 100)
Begin   
  Insert into tbWhatEva
     Select @I

Select @I = @I + 1         
End

Why is it so hard to populate arbitrary data in a loop? Please tell me where Im going wrong.

Thank you

2
Contributors
4
Replies
9
Views
6 Years
Discussion Span
Last Post by Tower-Rounder
0

Hi pritaeas.

The porblem isnt the table structure. Its the loop. Ive just quoted MS SQL syntax as that's how to do it in MSSQL. I just want to run a simple insert query multiple times in a loop. Im now sure how to define the loop in a way that My SQL understands.

Thanks for the reply

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.