TinyPortal

General => Chit chat => Topic started by: gfxindia on July 30, 2006, 04:31:19 PM

Title: MySQL Help
Post by: gfxindia on July 30, 2006, 04:31:19 PM
I am wanting to add a new field to a database table.
But i get this error.
Error

SQL query:

ALTER TABLE `simple_messages` ADD `extra` VARCHAR( 25 ) UNSIGNED NOT NULL AFTER `subject`

MySQL said: Documentation
#1064 - 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 'UNSIGNED NOT NULL AFTER `subject`' at line 1

Please Could somebody help me .
Title: Re: MySQL Help
Post by: eeek on July 30, 2006, 04:49:15 PM

ALTER TABLE `simple_messages` ADD `extra` VARCHAR( 20 ) NOT NULL AFTER `subject` ;

Is UNSIGNED not related to numbers (int, bigint, etc) which you dont have.
Title: Re: MySQL Help
Post by: gfxindia on July 30, 2006, 04:50:38 PM
So what should i do ?
Title: Re: MySQL Help
Post by: eeek on July 30, 2006, 05:07:25 PM
Dont know :)

Depends what it for? and what your trying to do? and how critical it is? why it has UNSIGNED in it for a start?

Whats going to be in the "extra" field?  - up to 20 Characters (VARCHAR( 20 )) just now ? if thats ok then UNSIGNED doesnt apply

so use

ALTER TABLE `simple_messages` ADD `extra` VARCHAR( 20 ) NOT NULL AFTER `subject` ;



Title: Re: MySQL Help
Post by: gfxindia on July 30, 2006, 05:11:06 PM
I'll try this
The extra is going to be some piece of text
Title: Re: MySQL Help
Post by: gfxindia on July 30, 2006, 05:11:38 PM
this worked
Thanks