Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > SQL help
  Last Thread   Next Thread
Share
Author
Thread    Post A Reply
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire
SQL help

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

Old Post Dec-18-2003 00:25  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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

Old Post Dec-18-2003 00:51 
Click Here to See the Profile for reveal Click here to Send reveal a Private Message Add reveal to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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

Old Post Dec-18-2003 00:59  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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

Old Post Dec-18-2003 01:01  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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.

i.e. just thread_id int primary key.


just tried:

code:
CREATE TABLE 'tstBB_thread' ( 'thread_id' integer(2) PRIMARY KEY, 'thread_starter' varcher(15), 'partOf_forum' integer(2));


pile of crap!

Old Post Dec-18-2003 01:06  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

and there i was thinking "yay!! here's DigiNut to the rescue.."

Old Post Dec-18-2003 01:10  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
DigiNut
You kids get off my lawn!



Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe

quote:
Originally posted by UglyDave
just tried:

code:
CREATE TABLE 'tstBB_thread' ( 'thread_id' integer(2) PRIMARY KEY, 'thread_starter' varcher(15), 'partOf_forum' integer(2));


pile of crap!

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

Old Post Dec-18-2003 01:13  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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

Old Post Dec-18-2003 01:19  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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

Old Post Dec-18-2003 01:22  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
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));


AND IT FUCKIN WORKED!!

Old Post Dec-18-2003 01:31  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > SQL help
Post New Thread    Post A Reply

 
Last Thread   Next Thread
Click here to listen to the sample!Pause playback-------- 2003 Prog House/House [2006] [0]

Click here to listen to the sample!Pause playbackKRYPTONIC - Chosen One [2007]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 16:47.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!