Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9111319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:28:35+00:00 2026-06-17T03:28:35+00:00

I want to load a CSV file using LOAD DATA INFILE command, but the

  • 0

I want to load a CSV file using LOAD DATA INFILE command, but the spaces after the commas are inconsistent i.e. there are commas which are followed by a space and commas that aren’t.

I tried using FIELDS TERMINATED BY "," directive, but some of the fields in the resulting table contained a leading space; If the input was

abc,def, ghi, klm

then after the loading my table had

column1 = 'abc'
column2 = 'def'
column3 = ' ghi'
column4 = ' klm'

Note that columns 3 and 4 contain a leading space.

I want my columns to not contain leading spaces. How should I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:28:36+00:00Added an answer on June 17, 2026 at 3:28 am

    Would this work?

    LOAD DATA INFILE 'file.csv'
    INTO TABLE t1 (column1, @col2, @col3, @col4)
    SET
      column2 = TRIM(@col2),
      column3 = TRIM(@col3),
      column4 = TRIM(@col4)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to select some data out of a CSV file before i load
I ran into some trouble using LOAD DATA INFILE command as i wanted to
I want to load a csv file into R from Java using JRI. For
I have a CSV file containing data. I want to load it into a
I have a CSV file I want to load at boot of my Lift
I want to load the form fields using json data. I am using extjs
I want to load PNG-file from resources. There is a roughly MFC-way (with CResourceStream
I have a CSV of file of data that I can load in R
Im trying to load a csv file into a datatable using oledb. This is
In order to load data (from a CSV file) into an Oracle database, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.