Miscellaneous Ramblings on Hacking

June 7, 2009

MySQL’s version of SQL*Loader

Filed under: Uncategorized — Zack @ 8:51 pm

Just found the nice command built into MySQL to load data files. It couldn’t have been simpler to use. Just be sure to through the right newline. Using ‘\r\n’ worked for a file generated in SSIS in my case.
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[CHARACTER SET charset_name]
[{FIELDS | COLUMNS}
[TERMINATED BY 'string']
[[OPTIONALLY] ENCLOSED BY 'char']
[ESCAPED BY 'char']
]
[LINES
[STARTING BY 'string']
[TERMINATED BY 'string']
]
[IGNORE number LINES]
[(col_name_or_user_var,...)]
[SET col_name = expr,...]

See more magic here from the MySQL manual.

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

Blog at WordPress.com.