peel
peel

Reputation: 45

How do I skip the first couple column when using a SQL Loader?

I am being given a .csv file that has 18 columns of useless data, then 10 columns of useful data and then another column of useless data. Is there anyway to just grab the 10 columns of useful data and just skip over the rest? I just want to start of reading the file at column 19 and finish at column 29.

Upvotes: 1

Views: 14000

Answers (2)

Eric BELLION
Eric BELLION

Reputation: 626

And with MySQL it would be :

LOAD DATA
INFILE file.csv
INTO TABLE test_sqlldr
APPEND
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
( 
  @ignore,
  @ignore,
  ...
  @ignore,
  col19,
  col20,
  ...
  col29
)

Upvotes: 0

Robert
Robert

Reputation: 25753

You have to use filler:

LOAD DATA
INFILE file.csv
INTO TABLE test_sqlldr
APPEND
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
( 
  col1 filler,
  col2 filler,
  ...
  col18 filler,
  col19,
  col20,
  ...
  col29
)

Here you can find more information.

Upvotes: 4

Related Questions