Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    I'm working a job for a guy who's got a rather extensive database of business listings that I need to get into an SQL database. What I'm faced with is how to import that huge chunk of data. He and his partner will reformat it however they need to so I can just pretty much click and import it, but I'm trying to figure out a good way to go about this. Basically, is there an easy way for them to arrange the data in something simple like Excel or Access and I just convert that to a .sql and import it?

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Usually if you use a good tool frontend they'll let you import CSV (comma-separated values) data. Sometimes even Excel data. phpMyAdmin supports the former and possibly the latter for MySQL, for example.

  4. #3
    Junior Member
    Join Date
    Sep 2007
    Posts
    1
    Member #
    15837
    Hello,
    Please take a look at db conversion tools at http://dbconvert.com
    Regards,
    Dmitry

  5. #4
    Senior Member imagn's Avatar
    Join Date
    Jul 2007
    Location
    Los Angeles
    Posts
    156
    Member #
    15594
    If it's any sort of "flat" file why not just read it and insert it via a script. At least this way you can control and/or format the information as you pull it in.

    <?php
    $filename = "filename.csv"; // FILE TO OPEN - CHANGE AS NEEDED
    $fd = fopen($filename, "r");
    $contents = fread($fd, filesize($filename));
    $deliminator = "\n"; // CHARACTER TO SPLIT LINES - CHANGE AS NEEDED
    $splitlines = explode($deliminator, $contents);
    $loopcount = count($splitlines);
    $var = 0;
    for ($i = 0; $i < $loopcount; $i++) {
    // 0 - Column 1 Info
    // 1 - Column 2 Info
    $value = $splitlines[$var];
    $value = explode(",", $value);
    $var++;
    $query = " INSERT INTO tableName
    (
    column_1,
    column_2
    )
    VALUES
    (
    '$value[0]',
    '$value[1]'
    ) ";
    $result = mysql_query($query);
    }
    ?>

  6. #5
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    I figured it out, it was just a matter of preping everything just right before hand. Excel and/or OpenOffice Spreadsheet work well for this. You have to remove the headers from the spreadsheet before exporting it to a .CSV file. As ShadowFiend said, phpMyAdmin makes it pretty easy to import, you just have to make sure you've already created the table and that the fields match the columns perfectly.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:04 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com