Reputation: 19648
I have a file that I need to load into mysql. Each record(Row) is delimited by the new line character '\n' and the the fields(columns) are delimited by ^A, which is the first character on the ASCII table.
I know I could use other tools to implement this: Like awk '\x01' and python chr(1), however, I want to figure out how to do that in MySQL itself.
I don't know what is the representation of ^A in MySQL, here is my load command.
mysql> load data local infile '~/result.sample' into table tableName fields terminated by '^A Goes Here' lines terminated by '\n';
If I know the unicode or the ascii representation of field delimiter, how could type that into mysql?
I tried CHAR(1) in mysql but it doesn't work for me.
mysql> load data local infile '~/result.sample' into table tableName fields terminated by CHAR(1) lines terminated by '\n';
Upvotes: 1
Views: 1360