本文介绍了LOAD DATA INFILE 使用 STR_TO_DATE(@var1,'%m/%d/%Y') 转换 2 个日期 - 抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是抛出错误,我无法弄清楚原因,有什么想法吗?
This is throwing an error, I am unable to figure out why, any ideas?
LOAD DATA LOCAL INFILE 'H:/Data/DB__Muni/data/msrb_AZ_short1.csv'
INTO TABLE import_mdrp FIELDS TERMINATED BY ';' LINES TERMINATED BY '\r\n'
(
Issuer, cusip6, state, Issue,
page_pointer, @var1, date_rng, cusip9, @var2,
yield, Amt_Offer_Dlr, Amt_Offer_Per, Security_Description,
Fitch, Moody, cusip_img, fitch_img, moody_img
)
SET maturity = STR_TO_DATE(@var2,'%m/%d/%Y')
SET issue_date = STR_TO_DATE(@var1,'%m/%d/%Y')
;
推荐答案
代替
SET maturity = STR_TO_DATE(@var2,'%m/%d/%Y')
SET issue_date = STR_TO_DATE(@var1,'%m/%d/%Y')
试试
SET maturity = STR_TO_DATE(@var2,'%Y-%m-%d')
SET issue_date = STR_TO_DATE(@var1,'%Y-%m-%d')
更新 1
SET maturity = DATE_FORMAT(STR_TO_DATE(@var2, '%m/%d/%Y'), '%Y-%m-%d'),
issue_date = DATE_FORMAT(STR_TO_DATE(@var1, '%m/%d/%Y'), '%Y-%m-%d')
这篇关于LOAD DATA INFILE 使用 STR_TO_DATE(@var1,'%m/%d/%Y') 转换 2 个日期 - 抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!