Re: Load Data into more than 1 Table
Dan Bolser <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Sorry, first time I read your mail wrong, I thought you had two files,
part of both to go to one table... Now I realize you have one file which
you want to part load twice.
This is easy...
From "man mysqlimport" (or it shoudl be... I found it at
http://dev.mysql.com/doc/mysql/en/mysqlimport.html)...
--columns=column_list, -c column_list
This option takes a comma-separated list of column names as its
value. The order of the column names indicates how to match up data file
columns with table columns.
(in linux) say
ln -s my_double_table_dump table_name_one.pipe
ln -s my_double_table_dump table_name_two.pipe
then
mysqlimport table_name_one.pipe --columns=1,2
ooops... That wont work, columns wan't table column names...
Cay you say
--columns=NULL,two,three
--columns-one,NULL,NULL
??
On Thu, 4 Nov 2004, Darren Duncan wrote:
>Once the writeable views support is functional, you should be able to
>just create a view that joins the two tables and has the interface
>matching your file; then just insert into the view from each file
>line. -- Darren Duncan
>
>At 4:49 PM +0000 11/3/04, Scott Simpson wrote:
>>Can I use 'LOAD DATA INFILE' to load data into more than 1 table?
>>
>>For example, say I have a text file containing
>>
>>1 birthday cat
>>2 anniversary dog
>>
>>and I want column 2 in table birthdays and column 3 in table pets and
>>I'm lazy and can't be bothered to split the file or loop through an
>>insert statement.
>>
>>Can someone suggest a shortcut?
>>
>>Thanks,
>>Scott
>
>
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]