« Return to Thread: Mysql Syntax

Re: Mysql Syntax

by Mike Ginou :: Rate this Message:

Reply to Author | View in Thread

Robert,

I created a very simple diagram that covers the basic schema you have
shown below.

I think you wanted to make the columns varchar(40) (variable character
fields with a maximum length of 40). To do that you simply specify the
length in parentheses as part of the datatype.

Mike

Robert Fulcher wrote:

> I have a single table and trying to get the hang of building tables in
> dia and them exporting them to mysql.  I can't get a single table to go
> over and am not sure what I am doing wrong.  It comes down to sql syntax
> that is created by tedia2sql (based on what I put in the uml model).
> Here is what I get:
>
> tiadia2sql output:
>
> create table contacts (
>   id                        int default 10 not null,
>   firstname                 varchar default 40 NULL,
>   lastname                  varchar default 40,
>   created                   datetime,
>   modified                  datetime,
>   constraint pk_Contacts primary key (id)
> ) ;
>
> When I try and run it I get:
>
> *SQL query:*
>
> CREATE TABLE contacts(
>
> id int default 10 NOT NULL ,
> firstname varchar default 40 NULL ,
> lastname varchar default 40,
> created datetime,
> modified datetime,
> CONSTRAINT pk_Contacts PRIMARY KEY ( id ) );
>
>
>
> *MySQL said: *Documentation
> <http://dev.mysql.com/doc/refman/5.0/en/error-returns.html>
>
> #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 'default 40 NULL,
>   lastname                  varchar default 40,
>   created    ' at line 3
>
>
> Does anyone know how I can fix this?  I know that I am not putting the
> info into the uml correctly but am not sure what and how to correct.
> Also I am using phpmyadmin is there a better tool for running the
> scripts that are created.
>
> Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

db.dia (1K) Download Attachment

 « Return to Thread: Mysql Syntax

LightInTheBox - Buy quality products at wholesale price!