[ACCEPTED]-Import hex/binary data into mysql-blob
Accepted answer
You can use the SET part of LOAD DATA INFILE, and 4 you don't need the 0x escaping stuff:
1, 1, 123456FF
2, 1, aabbcc
3, 1, ddeeff
And 3 then you assign the column to a variable, and 2 then set the column to the UNHEXed version 1 of that variable:
LOAD DATA INFILE 'file' INTO TABLE `table` (column1, column2, @var1)
SET column3 = UNHEX(@var1)
Couldn't find any alternative. It looks 3 like the only way is the binary
one (also, there 2 is already a bug/feature-request on mysql 1 regarding this).
Two things to consider:
- text-file encoding when generating the input file;
- character escaping (NEW-LINE, TAB, QUOTE, etc);
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.