Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings, I have a problem with the following code >>

SQL
DELIMITER $$

DROP PROCEDURE IF EXISTS insert_ten_rows $$

CREATE PROCEDURE insert_ell_rows ()
BEGIN
DECLARE crs INT DEFAULT 0;

WHILE crs < 11 DO
SET crs = crs + 1;
Insert into events Values(`img\air_show\air (`+crs`).jpg`,`Air Show`,`Air Base`,`0`);
END WHILE;
END $$


My problem is a syntax issue, I'm not sure if it's because of " `img\air_show\air (`+crs`).jpg` " but may you please aid in how I can better tackle this problem. Thank you so much in advance
Posted

1 solution

Actually I think your problem is the single quotes. You are using the ` character when you should be using the ' one.

SQL
Insert into events Values('img\air_show\air (' + crs + ').jpg','Air Show','Air Base','0');


Try that.
 
Share this answer
 
v3
Comments
wax-911 24-Jan-14 1:10am    
Thank you so much, I don't know what I was thinking and somehow the $$ were also causing some problems and when I call insert_ten_rows(); it runs through the loop perfectly but one of the columns with 'img\air_show\air (' + crs + ').jpg' returns only the variable 1-10 without any concatenation

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900