I'm inserting data into a table in MySQL using the following query,
LOAD DATA INFILE 'file.csv' INTO TABLE CSVImport FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
But when the length of a particular field is greater than the column length it fails as expected. Is there any way to trim the length and set to the length of the column. I know that I can change the sql_mode. But when I do that it will effect to other validations as well. And also it will applied to the whole mysql server as well.
1) Is there any way to apply the sql_mode only to a particular table?
2) Is there any way to achieve this without changing the sql_mode?