/ Forside / Teknologi / Udvikling / SQL / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
SQL
#NavnPoint
pmbruun 1704
niller 962
fehaar 730
Interkril.. 701
ellebye 510
pawel 510
rpje 405
pete 350
gibson 320
10  smorch 260
null error i MySQL
Fra : Henning Hansen


Dato : 31-01-04 13:45

Hej
Jeg kører i ring med et problem jeg ikke kan løse - og jeg kan ikke se
der er nogen fejl.
Jeg bruger MySQL ver 4.1.0

Jeg får fejlen
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 'NOT NULL, interpersonal TEXT NOT NULL, intrapersonal TEXT NOT N

når jeg forsøger at danne nedenstående tabel

CREATE TABLE nuke_zpers_ads
(
ad_id SMALLINT UNSIGNED NOT NULL auto_increment,
cat_id SMALLINT UNSIGNED NOT NULL,
user_name VARCHAR(20) NOT NULL,
email VARCHAR(50) NOT NULL,
subject TEXT NOT NULL,
descript TEXT NOT NULL,
age VARCHAR(2) NOT NULL,
height VARCHAR(20) NOT NULL,
weight TEXT NOT NULL,
hair VARCHAR(10) NOT NULL,
eyes VARCHAR(10) NOT NULL,
city VARCHAR(20) NOT NULL,
state VARCHAR(20) NOT NULL,
country VARCHAR(20) NOT NULL,
zip VARCHAR(10) NOT NULL,
intention VARCHAR(20) NOT NULL,
ideal_date TEXT NOT NULL,
turn_ons TEXT NOT NULL,
turn_offs TEXT NOT NULL,
url TEXT NOT NULL,
exercise TEXT NOT NULL,
diet TEXT NOT NULL,
smoking TEXT NOT NULL,
drinking TEXT NOT NULL,
employment TEXT NOT NULL,
income TEXT NOT NULL,
education TEXT NOT NULL,
creligion TEXT NOT NULL,
preligion TEXT NOT NULL,
fav_books TEXT NOT NULL,
role_mods TEXT NOT NULL,
pers_type TEXT NOT NULL,
worldview TEXT NOT NULL,
conciousness TEXT NOT NULL,
languages TEXT NOT NULL,
passion TEXT NOT NULL,
quotes TEXT NOT NULL,
musical TEXT NOT NULL,
bodily TEXT NOT NULL,
linguistic TEXT NOT NULL,
spatial TEXT NOT NULL,
interpersonal TEXT NOT NULL,
intrapersonal TEXT NOT NULL,
naturalist TEXT NOT NULL,
logical TEXT NOT NULL,
midealmate TEXT NOT NULL,
mdiet TEXT NOT NULL,
magef TEXT NOT NULL,
maget TEXT NOT NULL,
mweight TEXT NOT NULL,
mexercise TEXT NOT NULL,
msmoking TEXT NOT NULL,
mdrinking TEXT NOT NULL,
memployment TEXT NOT NULL,
mcreligion TEXT NOT NULL,
mpers_type TEXT NOT NULL,
mworldview TEXT NOT NULL,
mconciousness TEXT NOT NULL,
lastup_date INT NOT NULL,
views INT NOT NULL DEFAULT '0',
add_date INT NOT NULL,
exp_date INT NOT NULL,
approved TEXT NOT NULL,
PRIMARY KEY(ad_id)
)TYPE=MyISAM;


 
 
Peter Brodersen (31-01-2004)
Kommentar
Fra : Peter Brodersen


Dato : 31-01-04 14:02

On Sat, 31 Jan 2004 13:44:44 +0100, Henning Hansen
<henningf@fjernmail.dk> wrote:

>Jeg får fejlen
>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 'NOT NULL, interpersonal TEXT NOT NULL, intrapersonal TEXT NOT N
>
[..]

>linguistic TEXT NOT NULL,
>spatial TEXT NOT NULL,
>interpersonal TEXT NOT NULL,

"spatial" er et reserveret ord:
http://www.mysql.com/documentation/mysql/bychapter/manual_Language_Structure.html#Reserved_words

Du kan dog stadigvæk bruge det, men i alle henvisninger til det skal
du have backtics på, fx: `spatial`

Altså:
   `spatial` TEXT NOT NULL
og
   SELECT `spatial` FROM nuke_zpers_ads WHERE `spatial` LIKE ...

--
- Peter Brodersen

Ebbesen for president!

Henning Hansen (31-01-2004)
Kommentar
Fra : Henning Hansen


Dato : 31-01-04 14:40

On Sat, 31 Jan 2004 14:02:01 +0100, Peter Brodersen <usenet@ter.dk>
wrote:

....
>"spatial" er et reserveret ord:
>http://www.mysql.com/documentation/mysql/bychapter/manual_Language_Structure.html#Reserved_words
>
>Du kan dog stadigvæk bruge det, men i alle henvisninger til det skal
>du have backtics på, fx: `spatial`
>
>Altså:
>   `spatial` TEXT NOT NULL
>og
>   SELECT `spatial` FROM nuke_zpers_ads WHERE `spatial` LIKE ...


Det hjalp tak for hjælpen


Søg
Reklame
Statistik
Spørgsmål : 177558
Tips : 31968
Nyheder : 719565
Indlæg : 6408925
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste