Skip to content

Instantly share code, notes, and snippets.

@inoyakaigor
Created October 4, 2023 10:21
Show Gist options
  • Save inoyakaigor/7e406b1152076fdbebfdbe55e1cd3d8a to your computer and use it in GitHub Desktop.
Save inoyakaigor/7e406b1152076fdbebfdbe55e1cd3d8a to your computer and use it in GitHub Desktop.
MySQL/MariaDB import from CSV with multiple SET
LOAD DATA LOW_PRIORITY LOCAL INFILE 'C:\\Users\\InoY\\DOWNLO~1\\927D~1.CSV'
REPLACE INTO TABLE `pomoyka`.`jira_tasks`
CHARACTER SET utf8mb4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1
LINES (`key`, `resume`, @created, @updated, `status_from`, `status_to`, @status_date)
SET `created` = STR_TO_DATE(@created, '%d.%m.%Y %H:%i:%s'),
`updated` = STR_TO_DATE(@updated, '%d.%m.%Y %H:%i:%s'),
`status_date` = STR_TO_DATE(@status_date, '%d.%m.%Y %H:%i:%s')
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment