I was trying to insert some string values to a column column1
in mysql table using C#.
The values can keep changing every time.
Sometimes the application throws Data too long
exception.
I went through some posts:
- "Data too long for column" - why?
- Data truncation: Data too long for column 'logo' at row 1
- mysql- Mysql2::Error: Data too long for column 'description' at row 1
- Data truncation: Data too long for column 'Phone' at row 1
- MySQL data too long error
But my question is:
How can I programmatically decide how long string (or other data type) value is too long for a mysql column.
So that if the data is too long and cannot be inserted, I can manually truncate less useful data.