The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

Issue with columns with comma values

Hi,

 

I am trying to load the csv file on the vertica table.

 

I am having the issue since the column value itself has comma on it and columns seems to have shifted

 

row e.g.

 

"6027007","US","United States","WV","West Virginia","588","Clarksburg-Weston, WV","25301"

 

column "dblabel" which has the value "Clarksburg-Weston, WV", has varchar(55) on it. 

 

copy command I am using is:

 

COPY tbluser FROM '/vertica/tbldata.csv' UNCOMPRESSED DELIMITER ',' DIRECT;

 

Any suggestion?

Comments

  •  Not sure i understand what you need. (what do you mean by "shifted" ?)

    But if yo want to load the data even the data can contain your delimiter use the enclosed parameter.

    dbadmin=> create table tbltest(addr varchar(50), nr int);
    CREATE TABLE
    dbadmin=> copy tbltest from '/tmp/test' delimiter ',' enclosed by '"' direct;
    Rows Loaded
    -------------
    1
    (1 row)

    dbadmin=> select * from tbltest;
    addr | nr
    -----------------------+-------
    Clarksburg-Weston, WV | 25301
    (1 row)

    () 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.