I have created a table with column id
as varchar2(20)
. Now I want to modify it and change size to 13 i.e column id varchar2(13)
. How to achieve it? Thanks in advance
p.s.: I don`t have any data in my table.
You may try this for Oracle:-
alter table tablename modify
(
column_name varchar2(13)
);
Also If you dont have any data in the table then you can also drop
the table and then create
the table with the columname as varchar2(13)
Just run this query for MySQL:
ALTER TABLE tablename CHANGE column `id` varchar2(13);
See here for more details. If you have additional constraints on this column, specify those as well.