RE: Error creating table in MySQL 5.0

2004-05-10 Thread Victor Pendleton
Have you verified the syntax from the MySQL command line?

-Original Message-
From: Marvin Cummings
To: [EMAIL PROTECTED]
Sent: 5/9/04 7:26 PM
Subject: Error creating table in MySQL 5.0

Wondering if anyone can give me some help with this error I'm getting
when trying to create this table:

 

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 '$sql

 = CREATE TABLE $subdivtable (

$subdivcolumn[subdiv_title] varchar(50),

$su' at line 1

 

The syntax I'm using to create this table: 

 

...\bin\Mysql $sql = CREATE TABLE $subdivtable ( 
$subdivcolumn[subdiv_title] varchar(50), 
$subdivcolumn[subdiv_id] int(4) DEFAULT '0' NOT NULL
auto_increment, 
$subdivcolumn[country_id] int(4) NOT NULL, 
PRIMARY KEY(subdiv_id)); 

 

I'm running mysql 5.0 on a w2k3 server. 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Error creating table in MySQL 5.0

2004-05-09 Thread Peter Brawley
If a column is auto_increment it can't be DEFAULT 0.

PB
  - Original Message - 
  From: Marvin Cummings 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, May 09, 2004 7:26 PM
  Subject: Error creating table in MySQL 5.0


  Wondering if anyone can give me some help with this error I'm getting
  when trying to create this table:

   

  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 '$sql

   = CREATE TABLE $subdivtable (

  $subdivcolumn[subdiv_title] varchar(50),

  $su' at line 1

   

  The syntax I'm using to create this table: 

   

  ...\bin\Mysql $sql = CREATE TABLE $subdivtable ( 
  $subdivcolumn[subdiv_title] varchar(50), 
  $subdivcolumn[subdiv_id] int(4) DEFAULT '0' NOT NULL
  auto_increment, 
  $subdivcolumn[country_id] int(4) NOT NULL, 
  PRIMARY KEY(subdiv_id)); 

   

  I'm running mysql 5.0 on a w2k3 server.