Question:
database Error HELP PLZ ?
Kelly H
2008-10-21 19:37:16 UTC
When i try to creat a database i get this error


Error
SQL query:

CREATE TABLE `donavons_Testdatabase`.`Kelly` (
`price` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ,
`dis` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ,
INDEX ( `price` , `dis` )
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin

MySQL said:

#1170 - BLOB/TEXT column 'price' used in key specification without a key length

Can you help me fix it. Or give me step by step setup on the host monster mysql database.

PS if someone that knows what they are doing could IM ME that would be asome! THANK YOU SO MUCH FOR ALL YOUR HELP
Three answers:
anonymous
2008-10-21 19:51:51 UTC
First, what you are doing is to create a table.



Whle I'm not famliar with MySql, I work with both MsSql and Oracle and in either of those a blob/Clob/text type column cannot be used as an index. You must instead used a char,nchar or varchar,varchar2, nvarchar field with a declared max length. (further, in MSSql, I do not believe that a (n)varchar(MAX) can be used either).



I would bet that this is the problem.
TheMadProfessor
2008-10-22 15:10:13 UTC
While I agree that adding a field length to 'price' may solve your immediate problem, I see a more serious design flaw by defining the column that way to begin with. Why did you not define 'price' as some variety of numeric (probably like DECIMAL (5,2))? That way, you would be able to do computations on the field without messy extraction and conversion issues.
Ebad E
2008-10-22 02:55:59 UTC
im not so sure but i think you don't have the length of the column price. you just have to add a text size or better yet use a varchar

it should look like this:



'price varchar(20) NOT NULL default '',



try this im me if it does'nt work..


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...