Comments - LOAD DATA INFILE
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Suppose your CSV had datetimes in the 3rd column and in the form "2021/12/22 16:30:12" but you wanted to grab just the date digits:
LOAD DATA LOCAL INFILE 'path_file.csv' INTO TABLE 'mydb'.'mytable' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES ( col1, col2, @var_datefield, col4 ) SET col3 = replace(substr(@var_datefield,1,10),'/','')
Have you tried simply loading the date-time CSV field into a DATE MariaDB field?
I seem to recall that importing into a DATE field ignores anything past the ISA date portion of the field