List:General Discussion« Previous MessageNext Message »
From:David Stoltz Date:June 23 2010 4:33pm
Subject:RE: Table creation fail
View as plain text  
Actually,

 

That table isn't supposed to have a PK, so I removed that, and it
works...same effect you suggested.

 

Thanks!

 

From: Krishna Chandra Prajapati [mailto:prajapatikc@stripped] 
Sent: Wednesday, June 23, 2010 12:29 PM
To: David Stoltz
Cc: mysql@stripped
Subject: Re: Table creation fail

 

Hi, 

default cannot be used with primary key.

mysql> CREATE TABLE `testresults` (
    ->
    -> `id_employees` INTEGER DEFAULT NULL ,
    -> `id_test_test` INTEGER DEFAULT NULL ,
    -> `testdate` DATE DEFAULT NULL ,
    -> `result` VARCHAR( 10 ) DEFAULT NULL ,
    -> `resultsdescription` MEDIUMTEXT DEFAULT NULL ,
    -> `resultsdate` DATE DEFAULT NULL ,
    -> `nextdate` DATE DEFAULT NULL ,
    -> `ptlevel` VARCHAR( 10 ) DEFAULT NULL ,
    -> `givenhere` INTEGER not null primary key);
Query OK, 0 rows affected (0.11 sec)

Krishna



On Wed, Jun 23, 2010 at 9:51 PM, David Stoltz <Dstoltz@stripped> wrote:

Hi Folks,



I use an online SQL Design tool to design my tables, etc. This generates
script code that I can run in phpMySQL to create the tables, etc.



The below code is causing an error - see below:



CREATE TABLE `testresults` (

`id_employees` INTEGER DEFAULT NULL ,
`id_test_test` INTEGER DEFAULT NULL ,
`testdate` DATE DEFAULT NULL ,
`result` VARCHAR( 10 ) DEFAULT NULL ,
`resultsdescription` MEDIUMTEXT DEFAULT NULL ,
`resultsdate` DATE DEFAULT NULL ,
`nextdate` DATE DEFAULT NULL ,
`ptlevel` VARCHAR( 10 ) DEFAULT NULL ,
`givenhere` INTEGER DEFAULT NULL ,
PRIMARY KEY ( )

);

MySQL said:

#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 ')
)' at line 11



The bolded line above (resultsdate line) seems to be causing the
problem....nothing looks wrong to me....



Any ideas?



Thanks!

 


Thread
Table creation failDavid Stoltz23 Jun
  • Re: Table creation failKrishna Chandra Prajapati23 Jun
    • RE: Table creation failDavid Stoltz23 Jun
      • Re: Table creation failJoerg Bruehe24 Jun
        • Re: Table creation failPrabhat Kumar25 Jun
          • Re: Table creation failJohan De Meersman25 Jun
            • Re: Table creation failPrabhat Kumar25 Jun
  • Re: Table creation failmos23 Jun