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

  • SEARCH
  • Home
  • 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 3391184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:46:34+00:00 2026-05-18T03:46:34+00:00

I’ve imported a spreadsheet of U.S. Government statistics into a mysql table with the

  • 0

I’ve imported a spreadsheet of U.S. Government statistics into a mysql table with the aim of working through a tutorial.

However, it would appear that the U.S. Government has changed its formatting so that some of numerical figures are wrapped in quote marks, turning them into strings.

For example, this is the format of the tab-separated data that I’m supposed to have downloaded:

CN010010 01 001 “Autauga County, AL” 2005 23831 23061 770 3.2

However, it looks like this: CN010010 01 001 “Autauga County, AL” 2005 “23,831 ” “23,061 ” 770 3.2

As a result the two key columns of data (the 23831 and 23061 bits) that I want to import as integers are registering as 0 – presumably because it doesn’t meet the data type.

What’s the best solution for resolving this problem, now and in the future?

Thanks in advance.

  • 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-05-18T03:46:34+00:00Added an answer on May 18, 2026 at 3:46 am

    The “comma” might cause problem. Are you using load data infile for this?

    Assuming table definition:

    CREATE TABLE `t` (
      `code` varchar(255) DEFAULT NULL,
      `state` char(2) DEFAULT NULL,
      `city` char(3) DEFAULT NULL,
      `name` varchar(255) DEFAULT NULL,
      `year` int(11) DEFAULT NULL,
      `pop1` int(11) DEFAULT NULL,
      `pop2` int(11) DEFAULT NULL,
      `diff` int(11) DEFAULT NULL,
      `ratio` float DEFAULT NULL
    )

    The following would import the file:

    load data local infile "test.txt"
    into table t
    columns terminated by '\t'
    optionally enclosed by '"'
    (code, state, city, name, year, @var1, @var2, diff, ratio)
    set pop1=replace(@var1,",", ""),
        pop2=replace(@var2, ",", "");

    would insert the following row:

     code: CN010010
    state: 01
     city: 001
     name: Autauga County, AL
     year: 2005
     pop1: 23831
     pop2: 23061
     diff: 770
    ratio: 3.2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.