Problems with LOAD FROM
Posted in 2019
Topics: Data Types & Schema Design
Dear colleagues:
I ask for your help with a topic as trivial as it is to import data from a
plain text file, but that is driving me crazy.
I need to import data from a SQL Server 2005 to Informix. Just working with
SQL Server is an odyssey, but I managed to generate a .csv file with the data
I need. They are more than 1.7M of records of five (5) columns, and are all
delimited with "|" pipe
I created a temporary table with these five columns, but when I execute the
LOAD FROM ... INSERT INTO ... I get an error -846 in row one (1) thatindicates that the columns of the flat file do not match those of the table.
I have checked many times and there is no error in the file, as well as in the
table. I have opened the file with Excel, and it does it perfectly, obviously
loading part of the file because of its limitations.
The second column of the file is a DATETIME YEAR TO FRACTION (3), so I thought
it could cause me a problem, but if I treat it as VARCHAR it throws the same
error.
I hope someone can give me a hand because I don't know where to look anymore.
Grateful
If you could post the table definition and the offending line from the flat file, it would greatly help us to make more informed suggestions. Also the Informix version and operating system could give us some clues. Best regards, Luis Marques.
Dear Luis: The problem is already solved. After reviewing once and a thousand times both the text file and the Informix table, I detected in the text editor where the file was open, that the encoding of the file was UTF-16. I proceeded to change it to ANSI, I recorded it, and I could import it without problems. Apparently, the exports made by SQL Server are the UTF-16, which my Informix 7.31 TD6 engine (old man) does not like. Thank you very much for your attention. A hug! Gustavo