Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

MySQL WHILE ... DO syntax error

Avatar of Daniel Wilson
Daniel WilsonFlag for United States of America asked on
MySQL ServerSQL
12 Comments1 Solution2618 ViewsLast Modified:
I am getting the following error message:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Declare i INT Default 0; While i < 36500 DO Insert Into Calendar (_Date, _Day, _' at line 1

I have set my delimiter:
Delimiter $$

And my code's below.

Can anyone spot my syntax error?  I'm trying to follow the example at http://dev.mysql.com/doc/refman/5.0/en/while-statement.html

thanks!

{edited to adjust formatting of code}
Begin 
Declare i INT Default 0; 
While i < 36500 DO 
Insert Into Calendar (_Date, _Day, _Month, _Year) Values ('2009-01-01' + i, Day('2009-01-01'+i), Month('2009-01-01'+i), Year('2009-01-01' +i)); 
set i = i +1; 
End while; 
End$$
ASKER CERTIFIED SOLUTION
Avatar of Daniel Wilson
Daniel WilsonFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answers