控制文件:
load data
infile case8.dat.txt
replace into table manager "str '|\r\n'"
fields terminated by "," opptionally enclosed by '"'
(mgrno,mname,job,re char(100000))
数据文件:
10,smith,sales manager,this is smith.
he is a sales manager.|
11,allen.w,tech manager,this is allen.w.
he is a tech manager.|
16,blake,hr manager,"this is blake.he is a hr manager.the jobs responsibilities are in the following:
1.ensure the effective local implementation of corporate level hr initiatives and new programs.
2.take initiatives in defining hr strategy on attracting,hiring,integrating,developing,managing,rewarding and retaining talents for the sustainable development of company business.|
无法导入,求教数据文件应注意些什么?

解决方案 »

  1.   

    1、指定记录分隔符应该放在"infile 文件名"之后。
    2、关键字opptionally应为optionally。
    3、最后一个记录的re值缺少双引号,如果使用了双引号作为定界符,则必须要前后匹配。
    4、因为指定后每条记录的分隔符后面有回车换行,所以,在编辑数据文件时最后一行之后要按一下回车。load data
    infile case8.dat.txt "str '|\r\n'"
    replace into table manager
    fields terminated by "," optionally enclosed by '"'
    (mgrno,mname,job,re char(100000))
    数据文件:
    10,smith,sales manager,this is smith.
    he is a sales manager.|
    11,allen.w,tech manager,this is allen.w.
    he is a tech manager.|
    16,blake,hr manager,"this is blake.he is a hr manager.the jobs responsibilities are in the following:
    1.ensure the effective local implementation of corporate level hr initiatives and new programs.
    2.take initiatives in defining hr strategy on attracting,hiring,integrating,developing,managing,rewarding and retaining talents for the sustainable development of company business."|最后一行要有回车