mysql 文本文件导入
1:指定字段分隔符和行分隔符导入,参考地址:http://dev.mysql.com/doc/refman/5.1/en/load-data.html
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name
' [REPLACE | IGNORE] INTO TABLEtbl_name
[CHARACTER SETcharset_name
] [{FIELDS | COLUMNS} [TERMINATED BY 'string
'] [[OPTIONALLY] ENCLOSED BY 'char
'] [ESCAPED BY 'char
'] ] [LINES [STARTING BY 'string
'] [TERMINATED BY 'string
'] ] [IGNOREnumber
LINES] [(col_name_or_user_var
,...)] [SETcol_name
=expr
,...]
2:定长字段导入,fixed-width
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE '
file_name'
[REPLACE | IGNORE]
INTO TABLE tbl_name
(@row)
SET colum1= TRIM(SUBSTR(@row,start,end)),
colum2 = TRIM(SUBSTR(@row,start,end)),
.....
columN = TRIM(SUBSTR(@row,start,end))
;