UltraSmooth
Programmer
I have a txt file that I need to import regularly into a database. The fields are separated by '|' but the problem is that there can be whitespace after the field and the length of this whitespace can vary. The reason being is the txt field is created by a report engine that pads any field data that does not take up the maximum characters of the field definition.
If the field type is Text and the field has a lenght of 10, then any field data that does not have 10 characters will be padded at the end with whitespace for the remaining characters.
My data file can look like this (- represents whitespace)
H645464.34|Blue--
H3435.23--|Red---
H454 343--|Orange
I do have a small amount of control over the format of the txt file. I can surround the field data by quotes but whitespace can still come between the closing quote and the field terminator or the endOfLine character, ie.
"H3435.23"--|"Red"--
I could also have the quotes outside of the padded whitespace,ie.
"H3435.23 "|"Red--"
How can I tell the LOAD DATA INFILE function to ignore this whitespace? Any help would be appreciated.
If the field type is Text and the field has a lenght of 10, then any field data that does not have 10 characters will be padded at the end with whitespace for the remaining characters.
My data file can look like this (- represents whitespace)
H645464.34|Blue--
H3435.23--|Red---
H454 343--|Orange
I do have a small amount of control over the format of the txt file. I can surround the field data by quotes but whitespace can still come between the closing quote and the field terminator or the endOfLine character, ie.
"H3435.23"--|"Red"--
I could also have the quotes outside of the padded whitespace,ie.
"H3435.23 "|"Red--"
How can I tell the LOAD DATA INFILE function to ignore this whitespace? Any help would be appreciated.