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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -