John, thanks for your help, I've solved my problem splitting the field into
three fields on a temporary table. Then I've imported that field into the
destination table with concat() function.
Stefano

>-- Messaggio originale --
>From: John Doe <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: mysql@lists.mysql.com
>Subject: Re: Load data infile and text fields
>Date: Sun, 10 Apr 2005 02:32:28 +0200
>Cc: [EMAIL PROTECTED]
>
>
>Am Samstag, 2. April 2005 13.51 schrieb [EMAIL PROTECTED]:
>> First of all I hope you can be patient for my english....
>> I'm working with data import into mysql from a txt file. I'm using LOAD
>> DATA INFILE
>> command but I cannot correctly import a text column of 595 characters.
>> I receive this (very large) file from an external organization and this
>> file is made
>> without separators bitween fields. I know only the exact lenght of each
>> field. All is fine for fields < of 256 char, but I cannot import this
text
>> field of 595 characters. It's imported truncated at 255th character.
>> Help me please!
>> Stefano (osso)
>
>I think this is a case where the splitting into the fields is better done
>
>outside of mySQL.
>
>You could run a simple script which takes your original file with nondelimited
>
>records and produces a delemited file, and then import this delimited file.
>
>Following a simple, non-generic perl script you can adapt to your field

>lengths. The version below splits long records in fields of 13, 54, and
3
>
>chars length, taking input from STDIN and output to STDOUT, so you could
>use
>it like
>
>   $ ./split.pl < undelimited_file > delimited_file
>
>=== split.pl ===
>#!/usr/bin/perl
>
>use strict;
>use warnings;
>
>my $delimiter=";"; # or "\t" or whatever
>
>while (my $line=<STDIN>) { # process each line/record
> my @fields=$line=~/^(.{13})(.{54})(.{3})/; # split into field by fix lengths
> print join $delimiter, @fields; # output fields delimited
>}
>=== END split.pl ===
>
>greetings joe



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to