I am trying to redefine the number of varchars a column can have (in a MySQL db).
I am doing
alter table obj_details IMG_SRC IMG_SRC varchar(180);
I want to change the number of characters that can be used in the column IMG_SRC to 180 (it is currently 100). But I get an error saying that I should check the syntax near IMG_SRC IMG_SRC varchar(180).
To change a column name, enter the following statement in your MySQL shell: ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name; Replace table_name , old_column_name , and new_column_name with your table and column names.
In Object Explorer, right-click the table with columns for which you want to change the scale and select Design. Select the column for which you want to modify the data type. In the Column Properties tab, select the grid cell for the Data Type property and choose a new data type from the drop-down list.
Use the MySQL REPLACE() function to replace a substring (i.e. words, a character, etc.) with another substring and return the changed string.
Why did you write IMG_SRC
twice? You want:
ALTER TABLE obj_details MODIFY IMG_SRC varchar(180);
(For what it's worth the COLUMN
in MODIFY COLUMN
is optional, see here.)
You're missing MODIFY COLUMN
, and you're specifying IMG_SRC
twice for some reason.
Try this instead,
ALTER TABLE `obj_details` MODIFY COLUMN `IMG_SRC` VARCHAR(180);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With