How to not load headers in text files using copy command

Moderator: NorbertKrupa

Post Reply
hopewell
Beginner
Beginner
Posts: 29
Joined: Wed Mar 27, 2013 10:39 pm

How to not load headers in text files using copy command

Post by hopewell » Wed Aug 14, 2013 7:34 pm

Howdy,

I have a lot of text files I need to load into vertica. The first row in the files is a header and I want to avoid loading that info. in the database.

Here is an example of what I am talking about and what I don't want to happen!

Code: Select all

[dbadmin@vert1 ~]$ cat testdata.txt
header1,header2
1,data1
2,data2

[dbadmin@vert1 ~]$ vsql -c "copy testdata from '/home/dbadmin/testdata.txt' delimiter ',';"
 Rows Loaded 
-------------
           3
(1 row)

[dbadmin@vert1 ~]$ vsql -c "select * from testdata;"
   t1    |   t2    
---------+---------
 header1 | header2
 1       | data1
 2       | data2
(3 rows)
See how the header data was loaded :(

Thank you for your time!!!

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: How to not load headers in text files using copy command

Post by id10t » Wed Aug 14, 2013 7:58 pm

Hi!

Look here for SKIP parameter.

hopewell
Beginner
Beginner
Posts: 29
Joined: Wed Mar 27, 2013 10:39 pm

Re: How to not load headers in text files using copy command

Post by hopewell » Wed Aug 14, 2013 8:20 pm

Heh heh... That is easier than I thought it'd be. Thanks, dude!

Post Reply

Return to “New to Vertica”