hi all
what is SQL syntax to update DB enum field
example
Table Field
someField ENUM('', 'a', 'b', 'c', 'd')
I want to update with values
update someTable SET someField = ('a','c','')
I always get error data truncated for column xxxx
UPDATE enum Field
Moderator: General Moderators
Re: UPDATE enum Field
Do you want to change the list of values allowed
or update a row with a new value?
Code: Select all
ALTER TABLE table MODIFY COLUMN field ENUM(list,of,values) other informationCode: Select all
UPDATE table SET field = value WHERE conditionRe: UPDATE enum Field
I want to update a row with 3 values so lets say
UPDATE table SET field = 'value1','value2','value3' where bla
UPDATE table SET field = 'value1','value2','value3' where bla
Re: UPDATE enum Field
The column can have only one value (unless the DB does not support arrays and the column is not declared as array type - PostgreSQL support such columns)
That's why the value is truncated
That's why the value is truncated
Re: UPDATE enum Field
I understand, but in company where we are using early mentioned way of data storage, it is working in a way a have described. Don't know how to do it, but I need to update this field with multiple values separated by comma (","). Please help me by pointing me in right direction
Thank you in advance
Thank you in advance
Re: UPDATE enum Field
It's not multiple values. It's a string. One value.
Code: Select all
UPDATE table SET field = 'value1,value2,value3' where bla