3

这是抛出一个错误,我无法弄清楚为什么,有什么想法吗?

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') 
;
4

1 回答 1

7

代替

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')
于 2012-11-08T01:22:07.380 回答