I have a bit of an odd problem - I have a table in my database which is defined like this:
CREATE TABLE MYSCHEMA.TABLE1
(
SEGMENT_1 VARCHAR(20),
SEGMENT_2 VARCHAR(20),
PRIORITY INT
)
IN MYSCHEMA
COMPRESS YES
;
I'm trying to load data into it from a csv file using IBM Data Studio's data load function. The data in the csv looks like this (there is no header row):
1. SEGMENT_A | 1. SEGMENT_C | 1
1. SEGMENT_A | 2. SEGMENT_D | 3
1. SEGMENT_A | 3. SEGMENT_E | 4
2. SEGMENT_B | 1. SEGMENT_C | 2
2. SEGMENT_B | 2. SEGMENT_D | 5
The data all loads into the table with no errors. However, for some reason a couple of characters are being added to the first row, so that when I query all data from the table the results look like this:
SEGMENT_1 | SEGMENT_2 | PRIORITY
---------------|--------------|---------
»¿1. SEGMENT_A | 1. SEGMENT_C | 1
1. SEGMENT_A | 2. SEGMENT_D | 3
1. SEGMENT_A | 3. SEGMENT_E | 4
2. SEGMENT_B | 1. SEGMENT_C | 2
2. SEGMENT_B | 2. SEGMENT_D | 5
I would expect the data to look exactly as it does in the csv file, i.e. without the characters »¿ being included in the first row.
I have confirmed using Excel's equals function that the value '1. SEGMENT_A' which is having these characters added to it is identical to the value '1. SEGMENT_A' elsewhere in the csv file which is not having the characters added to it.
Does anyone know why this might be happening and how to fix it please?
Answer has been supplied in the comments by mao:
When saving the csv file in Excel, under Save as type select CSV instead of CSV UTF-8. Selecting CSV results in a file that can be loaded without the extra characters being added. Selecting other options may also work, but I haven't tested these.