1

I want to run the following sql command in phpmyadmin:

create table files(messageId INT NOT NULL, 
messageBlockId INT PRIMARY KEY AUTO_INCREMENT, 
data NVARCHAR(MAX), 
Signatures NVARCHAR(MAX), 
owner INT NOT NULL);  

I am gitting this error:

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 'MAX), Signatures NVARCHAR(MAX), owner INT NOT NULL)' at line 1

What should I do? I would have used the GUI in phpmyadmin to create table but it does not show NVARCHAR as datatype.

Edit: I tried to change NVARCHAR(MAX) to VARCHAR(MAX) but the error still exists. Its Okay if I use varchar but how do I remove the error?

Thanks :)

Community
  • 1
  • 1
Kashyap Kotak
  • 1,888
  • 2
  • 19
  • 38

1 Answers1

2

You should use VARCHAR(MAX), not NVARCHAR(MAX)

John Joe
  • 12,412
  • 16
  • 70
  • 135
  • but my code(for which I am creating the database) deals with nvarchar. I have a line in code saying getNString() in java. What is the difference between varchar(max) and nvarchar(max)? – Kashyap Kotak Mar 15 '17 at 14:47
  • This may help http://stackoverflow.com/questions/144283/what-is-the-difference-between-varchar-and-nvarchar – John Joe Mar 15 '17 at 14:51
  • Try giving a number instead of MAX. – John Joe Mar 15 '17 at 14:56
  • And also take note of the reserved words in Mysql https://dev.mysql.com/doc/refman/5.5/en/keywords.html – John Joe Mar 15 '17 at 15:05