What's wrong with this simple .sql file?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
AliJ
Forum Commoner
Posts: 32
Joined: Sun Dec 06, 2009 8:03 pm

What's wrong with this simple .sql file?

Post by AliJ »

Code: Select all

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

CREATE TABLE `chat` (
  `message_id` int(11) NOT NULL,
  `chat_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  `user_colour` varchar(6) NOT NULL,
  `message text` NOT NULL,
  `bbcode_bitfield` varchar(255) NOT NULL,
  `bbcode_uid` varchar(8) NOT NULL,
  `bbcode_options` tinyint(1) NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY  (`message_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `chat_sessions` (
  `user_id` mediumint(8) NOT NULL,
  `username` varchar(255) NOT NULL,
  `user_colour` varchar(6) NOT NULL,
  `user_login` int(11) NOT NULL,
  `user_firstpost` int(11) NOT NULL,
  `user_lastpost` int(11) NOT NULL,
  `user_lastupdate` int(11) NOT NULL,
  PRIMARY KEY  (`user_id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

When I import it, I get the 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 'NOT NULL,
`bbcode_bitfield` varchar(255) NOT NULL,
`bbcode_uid` varchar(8) N' at line 7
Your help would be appreciated, thank you.

Ali J.
AliJ
Forum Commoner
Posts: 32
Joined: Sun Dec 06, 2009 8:03 pm

Re: What's wrong with this simple .sql file?

Post by AliJ »

Nice to see everyone being so helpful :(.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: What's wrong with this simple .sql file?

Post by VladSun »

LOL, 13 minutes and nobody helped?!?

Code: Select all

`message text` NOT NULL,
See why syntax highlighting is so important?
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply