Skip to main content

Issue with columns with comma values

  • August 12, 2015
  • 1 reply
  • 10 views

riomario

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?

1 reply

Adrian_Oprea_1
Forum|alt.badge.img+1
  • Participating Frequently
  • August 12, 2015

 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)

()