'Weird characters showing up when importing from csv files in sql
I'm trying to import data from a csv file into SQL but I keep getting the error
\copy owner (owner_id, owner_name, owner_surname) FROM 'C:\Users\Documents\owners.csv' DELIMITER ',';
ERROR: invalid input syntax for type integer: "0"
CONTEXT: COPY owner, line 1, column owner_id: "0"
Here's what owners.csv looks like
I understand that the error is to do with the encoding and that I should change the encoding to UTF 8 BOM, which I have done but the error still persist
Solution 1:[1]
0 in WIN1252 is hexadecimal 0xEFBBBF30, which would be a BOM and a 0.
Remove that BOM from the file, and you will get better results.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Laurenz Albe |

