List:General Discussion« Previous MessageNext Message »
From:mos Date:July 9 2004 9:50pm
Subject:Re: Loading data into "TEXT" column;
View as plain text  
At 12:23 PM 7/9/2004, you wrote:
>Hi,
>
>I'd like to load "TEXT"-data of variable length
>into an existing table with "CHAR"-columns.
>
>The input file consists of about 4200 lines
>with alphanumeric characters and newline only.
>
>Instead of filling up the "TEXT"-column
>next to the existing columns, Mysql
>appends new rows, filling up the "TEXT" column
>beginning behind the last row of the former table.
>
>I tried many options of "LOAD DATA INFILE" and
>checked my input file for problematic characters.
>Didn't help. I'm totally stuck and stopped
>working on the project.
>
>Could you tell me how to import my
>"TEXT" data correctly ?
>
>Thanks a lot for your help.
>
>Harald
>

Harald,
         1) load the data into a temporary table whose structure matches 
that of the data in your text file

CREATE TABLE `tableb` (
   `Rcd_Id` int(10) NOT NULL auto_increment,
   `cust_name` char(10) default NULL
)

         2) Load the data into the temp tableb using "Load Data  Infile ..."

         3) Once the data is in a database table, you can update an 
existing table wrt to another table doing something like:

update tablea, tableb  set tablea.cust_name = tableb.cust_name where 
tablea.rcd_id=tableb.rcd_id

Mike 

Thread
Loading data into "TEXT" column;Jens Gerster9 Jul
  • Re: Loading data into "TEXT" column;mos9 Jul
    • Re: Loading data into "TEXT" column;Jens Gerster10 Jul
RE: Loading data into "TEXT" column;Victor Pendleton9 Jul
  • RE: Loading data into "TEXT" column;Jens Gerster9 Jul