MySQL Forums
Forum List  »  MySQL Workbench

Error Code: 1064 You have an error in your SQL syntax
Posted by: Adamou MFAMBOU
Date: September 23, 2022 09:40AM

Message output: "Error Code: 1064 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 'IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME='$tablename' and TYPE='U') BE' at line 1"

My script: "IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME='$tablename' and TYPE='U') BEGIN CREATE TABLE $tablename (messageid VARCHAR(60) PRIMARY KEY,createdate DATETIME DEFAULT getdate(),serializedmessage TEXT) CREATE INDEX $tablename_index ON $tablename(messageid) END"

I am using MySQL Server 8.0.29

Please help me to write the good syntax.

Options: ReplyQuote


Subject
Views
Written By
Posted
Error Code: 1064 You have an error in your SQL syntax
61
September 23, 2022 09:40AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.