Log in

View Full Version : SQL Help


nubian
01-06-2005, 11:43 PM
can someone please help me with this query.
i'm no sql guy and i'm getting syntax error:

i need to add this:
ALTER TABLE `".TABLE_PREFIX."post` ADD COLUMN `warn_flag` int(5) default 0 AFTER attach

my prefix is this:

i tried entering it like this:
ALTER TABLE vb3_post ADD COLUMN `warn_flag` int(5) default 0 AFTER attach

but i'm getting syntax error.
please help.
thanks in advanced.

Aros
01-06-2005, 11:46 PM
Try this:

ALTER TABLE `vb3_post` ADD COLUMN `warn_flag` int(5) default 0 AFTER attach

This should work if vb3_ is your table prefix set in your config.

nubian
01-07-2005, 12:13 AM
Try this:

ALTER TABLE `vb3_post` ADD COLUMN `warn_flag` int(5) default 0 AFTER attach

This should work if vb3_ is your table prefix set in your config.

vb3 is my prefix.
i got this when i copied and pasted your code.

Error

SQL-query :

ALTER TABLE `vb3_post` ADD COLUMN `warn_flag` int( 5 ) default0 AFTER attach

MySQL said:

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 'default0 AFTER attach' at line 1

Aros
01-07-2005, 12:21 AM
There's a space missing between default and 0.

nubian
01-07-2005, 12:38 AM
i have no clue as to why it's reading that there's no spaces between default and 0 because it's not all all.
i copied and pasted exactly what you have above.
my sql knowledge is noobish so i wouldn't know how to manually add it.

can i add it like this:
ALTER TABLE `vb3_post` ADD COLUMN `warn_flag` int(5) AFTER attach

without the default 0

nubian
01-07-2005, 12:44 AM
i figured it out.
i got the old retarded version of MySQL 4.0.22
this worked:
ALTER TABLE `vb3_post` ADD COLUMN `warn_flag` int(5) default '0' AFTER attach;

nubian
01-07-2005, 01:00 AM
more enough i thank you greatly!