What does MySQL converting varchar to char? -


when add new table, made mistake : field varchar(255), have write join queries. alter table make char(6).

my question : mysql in case ? trims right ?

rather worry mysql or doesn't why not convert data before change.

e.g.

update yourtable set yourfield = left(yourfield,6);  alter table yourtable modify column yourfield char(6) 

you should note if column data long won't let alter assuming enable strict sql mode see shef's complete answer


Comments

Popular posts from this blog

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

java - Why is BlockingQueue.take() not releasing the thread? -

jQuery Ajax Render Fragments OR Whole Page -