I have a very simple text file containing two values, separated by a comma, whose length is about 100 lines. This file is created by an automatic process (which I cannot control), and I import this file into SQL via SSIS.
My work works very well, unless there is an empty line in the file. By this I mean that it is completely empty - no commas or other characters. When this exists in the file, the record immediately after import will be imported with two spaces before the imported value.
For example, if a text string contains this “ABC, 123”, the imported SQL value will be “ABC” for the first column. I tried to remove this using a derived column with a TRIM statement, but this did not affect. The REPLACE function also did not work. The really strange part is that if I add a data viewer just before the data stream, the value will look normal. I even added asterisks so that I could “see” spaces if they exist, for example:
"*" + REPLACE([Column 0]," ","") + "*"
This is an extremely annoying problem, and I would really appreciate any suggestions. Thank!
source
share