Hi there! I'm fairly new to MySQL and have been given the task to 'create procedures' I've done this exactly the way i think i should but keep getting an error referring to my syntax; 17:05:02 [CREATE - 0 row(s), 0.000 secs] [Error Code: 1064, SQL State: 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 'sp_email_create' ( IN temp_accountid CHAR(35) IN temp_email VARCHAR(140) ) BEGIN INS' at line 1 ... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors] This is what I have written; CREATE PROCEDURE 'MailingList''sp_email_create' ( IN temp_accountid CHAR(35) IN temp_email VARCHAR(140) ) BEGIN INSERT INTO tbl_emails(accountid, email) VALUES (temp_accountid,temp_email) END Please help...baffled to hell!
Welcome to the forum! This forum is dedicated to Microsoft SQL Server. [] Does this work for you in MySQL? DELIMITER $$ DROP PROCEDURE IF EXISTS `MailingList`.`sp_email_create` $$ CREATE PROCEDURE `MailingList``sp_email_create` ( temp_accountid CHAR(35), temp_email VARCHAR(140) ) INSERT INTO tbl_emails(accountid, email) VALUES (temp_accountid,temp_email) $$ DELIMITER ;
Hi! As soon as i clicked send i realised that this was MS dedicated, but anyways thanks for your help, i gave it a go and it came up with a similar error as before, to be honest much more helpful than the guys on the MySQL forum!! Many Thanks Alex
See what happens when you try this? DELIMITER $$; DROP PROCEDURE IF EXISTS `mysql`.`sp_email_create`$$ CREATE PROCEDURE `mysql`.`sp_email_create` ( temp_accountid CHAR(35), temp_email VARCHAR(140) ) BEGIN INSERT INTO tbl_emails(accountid, email) VALUES (temp_accountid,temp_email); END$$ DELIMITER ;$$