patternsqlMinor
skip columns while using LOAD command mysql
Viewed 0 times
whilecolumnsskipmysqlusingloadcommand
Problem
I have a csv file having 5 columns and i want to load only one out of that, is there a way i can do it. I want to use LOAD statement of MySQL 5.5
Any pointers are welcomed, help would be much appreciated
Any pointers are welcomed, help would be much appreciated
Solution
From the documentation:
You can also discard an input value by assigning it to a user variable
and not assigning the variable to a table column:
You can also discard an input value by assigning it to a user variable
and not assigning the variable to a table column:
LOAD DATA INFILE 'file.txt'
INTO TABLE t1
(column1, @dummy, column2, @dummy, column3);Code Snippets
LOAD DATA INFILE 'file.txt'
INTO TABLE t1
(column1, @dummy, column2, @dummy, column3);Context
StackExchange Database Administrators Q#42266, answer score: 8
Revisions (0)
No revisions yet.