List:General Discussion« Previous MessageNext Message »
From:Gleb Paharenko Date:November 2 2004 7:41am
Subject:Re: Disincluding columns when using load data
View as plain text  
Hi.
You may use lines starting by '\t' to ignore first column (if your outfile has default
format).

For example:

select * from t4;
+------+------+------+------+
| a    | b    | c    | d    |
+------+------+------+------+
|    1 |    2 |    3 |    4 |
|    2 |    6 |    7 |    4 |
|    3 |   10 |   11 |   20 |
+------+------+------+------+

select * from t4 into outfile 't4.txt';

cat t4.txt

1       2       3       4
2       6       7       4
3       10      11      20

load data infile 't4.txt' into table t3 lines starting by '\t';

select * from t3;
+------+------+------+
| b    | c    | d    |
+------+------+------+
|    2 |    3 |    4 |
|    6 |    7 |    4 |
|   10 |   11 |   20 |
+------+------+------+



Dan Stark <spokeman@stripped> wrote:
> I've checked through the archives a documentation but cannot find an
> answer to my problem. I'm attempting to load data from a text file
> that has a column that is not present in my database table.
> 
> Table
> B C D
> 
> File
> A B C D
> 
> I've been trying to find a way to ignore the first column of the text
> file by specifiing columns like:
> (Null,B,C,D) or ('',B,C,D) but mysql doesn't understand these
> commands. Is there a way to ignore columns with load data?
> 
> TIA
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   Gleb.Paharenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com



Thread
Disincluding columns when using load dataDan Stark1 Nov
  • Re: Disincluding columns when using load dataGleb Paharenko2 Nov
  • Re: Disincluding columns when using load dataDusan Pavlica2 Nov