Hi,
I can't see an option to insert an integer as a default value in the table editor, only Text, NULL, CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP, and AUTO_INCREMENT.
?
_da.
How to insert integer as default value?
Yes, you have to put numbers with the text option.
The reason for why numbers get treated as text here is that a SHOW CREATE TABLE also returns numbers as quoted strings. No chance to detect numeric values as such. However, a cosmetic problem, as the server will deny your ALTER statement if it contains an invalid default value.
The reason for why numbers get treated as text here is that a SHOW CREATE TABLE also returns numbers as quoted strings. No chance to detect numeric values as such. However, a cosmetic problem, as the server will deny your ALTER statement if it contains an invalid default value.
Yes, you have to put numbers with the text option.
The reason for why numbers get treated as text here is that a SHOW CREATE TABLE also returns numbers as quoted strings. No chance to detect numeric values as such. However, a cosmetic problem, as the server will deny your ALTER statement if it contains an invalid default value.
You know the data type of the column is numeric, so you could use that information to generate an unquoted value.
Then change "Text:" to "Value:" or whatever where you input the default value.
Just a thought.
_da.
Anse,
The issue is when you don't wish to specify a default value (you want to use the implicit default value for the column data type). Then you get CREATE code like this:
CREATE TABLE `my_table` (
`Column 1` INT(10) NOT NULL DEFAULT ''
)
... which gives you an error. You need to be able to specify a default value of "None" (which should probably be positioned before all other options).
Also, if an existing table has fields without explicit defaults, the CREATE code incorrectly shows a default value of '' (empty string) for integer types (it shouldn't show any default value – for other data types as well). On more than one occasion I've sent CREATE code to a friend and he's been like "WTF?".
Thanks,
_da (Glen).
The issue is when you don't wish to specify a default value (you want to use the implicit default value for the column data type). Then you get CREATE code like this:
CREATE TABLE `my_table` (
`Column 1` INT(10) NOT NULL DEFAULT ''
)
... which gives you an error. You need to be able to specify a default value of "None" (which should probably be positioned before all other options).
Also, if an existing table has fields without explicit defaults, the CREATE code incorrectly shows a default value of '' (empty string) for integer types (it shouldn't show any default value – for other data types as well). On more than one occasion I've sent CREATE code to a friend and he's been like "WTF?".
Thanks,
_da (Glen).
Just noticed issue #1261. :)
Please login to leave a reply, or register at first.