If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > this is an easy one?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-04, 09:02
ARC ARC is offline
Registered User
 
Join Date: Apr 2002
Location: UK
Posts: 12
this is an easy one?

This must be simple but I keep getting an error when trying to create the following table. I've been on it 30 mins and it's driving me mad! Please help?

Error

SQL-query :

CREATE TABLE `product` (

`UPC` TEXT( 20 ) NOT NULL ,
`ShortDescription` TEXT( 50 ) NOT NULL ,
`LongDescription` LONGTEXT( 500 ) NOT NULL ,
`Price` FLOAT( 7 ) NOT NULL ,
`MainCategory` TEXT( 50 ) NOT NULL ,
`SubCategory` TEXT( 50 ) NOT NULL ,
`ImageID` TEXT( 50 ) NOT NULL ,
`Supplier` TEXT( 50 ) NOT NULL ,
`SearchRef` TEXT( 100 ) NOT NULL ,
PRIMARY KEY ( `UPC` )
)

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 '( 20 ) NOT NULL ,
`ShortDescription` TEXT( 50 ) NOT NULL
Reply With Quote
  #2 (permalink)  
Old 11-27-04, 09:14
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
did you actually check the manual as suggested?

neither TEXT nor LONGTEXT takes a length parameter

you're thinking of VARCHAR

change TEXT(n) to VARCHAR(n) where n is less than or equal to 255

if you need a column to hold more than 255 bytes, then use TEXT (with no length parameter) which will give you a 65K field
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On