Alter table merry_parents change mobile mobile char(10).
When I do the above I’m getting error:
#1265 – Data truncated for column ‘mobile’ at row 2
How can I truncate my mobile field to char(10)? Currently it is char(12).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The error is telling you that there is data 12 characters long in row 2 (and probably others) so it’s stopped the alter command to avoid losing data.
Try updating your table using
SUBSTRING()to shorten the column. It’s unclear why you want to do this as you’ll lose data, but this will truncate the data to 10 characters long:Then run your alter command: