Skip to main content
Question

Rejected Reason: Too Many Columns Found

  • January 15, 2020
  • 4 replies
  • 19 views

BWCempl237

When I try to copy a file from my local drive the majority of records are not copying with the rejected reason: too many columns found. I am trying to copy the exact same columns from the file, though, into the table. Has anyone encountered this error before or know what it means?

4 replies

SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • January 15, 2020

please share sample rows, table definition and your COPY statement.


LenoyJ
Forum|alt.badge.img+1
  • Participating Frequently
  • January 15, 2020

Check the delimiter in your COPY command - if you are loading strings that may have the delimiter character within it, it may break the format and that would be perceived as too many columns. You could use the ENCLOSED BY option if your strings are quoted. See the section "Delimiting Characters (ENCLOSED BY)" at this link: https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AdministratorsGuide/BulkLoadCOPY/LoadingUTF-8FormatData.htm


mosheg
Forum|alt.badge.img+2
  • Participating Frequently
  • January 15, 2020

In addition, try to use unprintable character as a delimiter, to eliminate the risk that your data include a delimiter character.
The following examples use \001 (CTRL-A) as field separator and \002 (CTRL-B) as record separator.
Export 2000 rows from a table to a file:
vsql -F $'\001' -R $'\002' -P null='REALNULL' -AXtnqc "select * from schema_name.table_name limit 2000" > file_name.tbl
Load the file data back to a table:
copy schema_name.table_name from 'file_name.tbl' delimiter E'\001' record terminator E'\002' null 'REALNULL' abort on error;


BWCempl237
  • Author
  • New Participant
  • January 15, 2020

Enclosed by ' " ' command was what I was missing LenoyJ, thanks!