folks, i'm using some gay web interface to create database tables.
code:
CREATE TABLE `tstBB_thread` (
`thread_id` INT NOT NULL ,
`thread_starter` VARCHAR NOT NULL ,
`partOf_forum` INT NOT NULL ,
PRIMARY KEY ( `thread_id` )
)
that code is generated..
this is the error i get:
You have an error in your SQL syntax near 'NOT NULL, `partOf_forum` INT NOT NULL, PRIMARY KEY (`thread_id`))' at line 1
anyone?
David
Dec-18-2003 00:25
reveal
always in the mix
Registered: May 2001
Location: Sweden
What happens if you write like this?
code:
CREATE TABLE `tstBB_thread` (
`thread_id` INT NOT NULL primary key,
`thread_starter` VARCHAR NOT NULL ,
`partOf_forum` INT NOT NULL
)
___________________
man with no sig
Dec-18-2003 00:51
UglyDave
i ran a marathon : )
Registered: Jan 2003
Location: Buncrana, Éire
quote:
Originally posted by reveal
What happens if you write like this?
code:
CREATE TABLE `tstBB_thread` (
`thread_id` INT NOT NULL primary key,
`thread_starter` VARCHAR NOT NULL ,
`partOf_forum` INT NOT NULL
)
that's how i would have done it if i were writing it myself..
i tried your example and got the following error:
"You have an error in your SQL syntax near 'NOT NULL , `partOf_forum` INT NOT NULL )' at line 1"
whih the bloody error messages wern't so vague..
thanks for the help all the same!
Dave
Dec-18-2003 00:59
DigiNut
You kids get off my lawn!
Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
quote:
Originally posted by UglyDave
that's how i would have done it if i were writing it myself..
i tried your example and got the following error:
"You have an error in your SQL syntax near 'NOT NULL , `partOf_forum` INT NOT NULL )' at line 1"
whih the bloody error messages wern't so vague..
thanks for the help all the same!
Dave
A primary key by definition can't have null values, so that's redundant.
Take away the "not null" for the primary key and just leave the "primary key" keywords.
i.e. just thread_id int primary key.
___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares ¶ Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp ☼ I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here
Dec-18-2003 01:01
UglyDave
i ran a marathon : )
Registered: Jan 2003
Location: Buncrana, Éire
quote:
Originally posted by DigiNut
A primary key by definition can't have null values, so that's redundant.
Take away the "not null" for the primary key and just leave the "primary key" keywords.
What version of SQL are you writing this for? The syntax looks totally alien to me, here's what it would look like for MSSQL:
code:
CREATE TABLE tstBB_thread {
thread_id int primary key,
thread_starter varchar(15),
partOf_forum int
}
But yours may work differently. Try your last code, but take out the integer(2) and replace them with just int, and spell varchar right.
Edit: should be acceptable to add "not null" before the comma on the LAST TWO declarations (starter and partof).
___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares ¶ Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp ☼ I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here
Dec-18-2003 01:13
UglyDave
i ran a marathon : )
Registered: Jan 2003
Location: Buncrana, Éire
the thing that's pissin me off the most, is that there's an interface for creating tables and all that, all u do is enter the amount of rows and the table name.
then it asks u for the individual values.
it's very very annoyin.
i'm about to giv up. drink my can of guinness then off to bed.
David
Dec-18-2003 01:19
DigiNut
You kids get off my lawn!
Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
quote:
Originally posted by UglyDave
the thing that's pissin me off the most, is that there's an interface for creating tables and all that, all u do is enter the amount of rows and the table name.
then it asks u for the individual values.
it's very very annoyin.
i'm about to giv up. drink my can of guinness then off to bed.
David
Did you try what I just said? What was the result?
You should also be able to generate the tables with that utility, and generate a TSQL script for it within the same utility.
___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares ¶ Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp ☼ I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here
Dec-18-2003 01:22
UglyDave
i ran a marathon : )
Registered: Jan 2003
Location: Buncrana, Éire
tried your example, but no joy.
i set up a phpBB a few months ago on the same database, so i've just retrieved some code from it, so i'm gonna try it's syntax.
another thing that's possible..
with digitalspace.net (my hosting crew), u get 1 free database, then the rest u have to pay for..
i have 30 tables in this one.. and i'm thinkin that maybe there's a restriction on the amount of tables / database..
about to try:
code:
CREATE TABLE phpbb_config (
config_name varchar(255) NOT NULL,
config_value varchar(255) NOT NULL,
PRIMARY KEY(config_name));