Nadia Krawczyk
Nadia Krawczyk

Reputation: 119

SQL newbie needs to know what is wrong

Just started playing with MySQL and I've already made stupid mistake which is somewhere in there; that's what I need to figure out:

CREATE TABLE `txts` (
 `ID` INT NOT NULL AUTO_INCREMENT, 
 `name` VARCHAR(75) NOT NULL,
 `content` VARCHAR(MAX) NOT NULL,
 `lastupdate` DATE NOT NULL default '0000-00-00',
 PRIMARY KEY (`ID`)
)ENGINE=MyISAM  DEFAULT CHARSET=utf8;

It gives:

#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) NOT NULL,
`lastupdate` DATE NOT NULL default '0000-00-00', PRIMARY KEY ' at line 4

I know it's extremely stupid but I can't see a single mistake in it.

Upvotes: 1

Views: 71

Answers (1)

Matt Clark
Matt Clark

Reputation: 28609

VARCHAR(MAX)

MySQL does not support the use of MAX.

Use an real number value.

Per Google:

The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions.

Upvotes: 7

Related Questions