Reputation: 27
In my CSV file there is:
prenom; nom; age
prenom1; nom1; age1
prenom2; nom2; age2
...
When I import my CSV file using this command:
CREATE TABLE TEST AS SELECT * FROM CSVREAD('C:\Users\anonymous\Desktop\test.csv');
The main problem is that my database has 1 column with my CSV file..
I would like 3 columsn with prenom
, nom
and age
with the data in each column.
Thanks for your help!
Upvotes: 0
Views: 2973
Reputation: 3314
As @jdv stated, you must specify the field separator if it is not the default ,
. The null
specifies that the column names will be parsed from the first row.
CREATE TABLE TEST AS SELECT * FROM CSVREAD('C:\Users\anonymous\Desktop\test.csv',null,'fieldSeparator=;');
Keep in mind you may have to specify charset=Cp1252
as well, if the CSV file was generated with Excel. If you see something like prénom
you have the wrong encoding.
Upvotes: 3