Skip to main content
Question

using COPY command to skip column

  • Sep 5, 2019 10:48 AM UTC
  • 2 replies
  • 16 views

elghali
Forum|alt.badge.img+1

Hello, I am trying to load a file into a table using COPY command, considering the source file contains columns col1, col2, col3 and the destination table contains columns col1, col2, col3 also.
I want to skip col2 from loading (I want to keep it NULL in the destination table)
I tried to use FILLER but it didn't work, so how to skip this column please

2 replies

elghali
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • Sep 5, 2019 11:43 AM UTC

COPY t1 (col1,
v1 FILLER VARCHAR(20),
col3)
FROM LOCAL 'C:\folder\file1.csv'
WITH DELIMITER AS ','


viganog
Forum|alt.badge.img+1
  • Participating Frequently
  • Sep 5, 2019 11:52 AM UTC

please try in this way:
COPY t1 (col1,
f_v1 filler VARCHAR,
col2 as NULL,
col3)
FROM LOCAL 'C:\folder\file1.csv'
WITH DELIMITER AS ','