Reputation: 31237
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:
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.
Upvotes: 0
Views: 756
Reputation: 6133
This is done in your db. The database structure tells you what is to long. The errors you're getting are coming from the database.
So the decision is when the database was created.
limits
are setUpdate As you question changed:
To truncate your data, see step 2 from above, use that info to truncate.
Upvotes: 1