+ 3

What is the error in this code?

I'm trying to create a table in MySQL, where the server and MySQL are working fine. I select my DB and I enter the command: CREATE TABLE fechas ( ID int NOT NULL, Dia int NOT NULL, Mes(10) NOT NULL, Anho int NOT NULL, PRIMARY KEY(ID) ); I get: 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 '(10) NOT NULL,  Anho int NOT NULL, PRIMARY KEY(ID) )' at line 6 Can anyone help me?

21st Feb 2018, 1:35 PM
Juca Navaz Reque
Juca Navaz Reque - avatar
1 Answer
+ 2
You need to change Mes(10) to Mes nvarchar(10) like the following. CREATE TABLE fechas ( ID int NOT NULL, Dia int NOT NULL, Mes nvarchar(10) NOT NULL, Anho int NOT NULL, PRIMARY KEY(ID) );
21st Feb 2018, 2:02 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar