RE: LOAD DATA INFILE

"Bonnett, John" <[email protected]> Tue, 3 Jul 2007 08:13:40 +0930
Newsgroups gmane.comp.db.mysql.windows
Message-ID <[email protected]>
Although I have never used those LOAD DATA type commands, it seems they
work with whole rows and you cannot do what you want directly. What you
would need to do would do is load your data into a temporary table, run
an UPDATE query to update the required columns in the original table and
then delete the temporary table. I see the data you are loading seems to
have a primary key field which is just what you need to do what I have
described. In the UPDATE query you join the temporary table to the
original table using this key.

If you are not sure how to do that, please contact me. You will need to
give me more details about your original table (the output of SHOW
CREATE TABLE will be enough) plus the details about which columns you
want to update.

John Bonnett

-----Original Message-----
From: Ilavajuthy Palanisamy [mailto:[email protected]] 
Sent: Thursday, 28 June 2007 4:38 AM
To: [email protected]
Subject: LOAD DATA INFILE

Hi,

 

I have a question on LOAD DATA INFILE command.

I have a table with 10 columns. Is it possible to update only few
columns of this table using LOAD DATA INFILE?

 

When I tried, it updates the specified columns but other columns are set
to NULL.

 

The command that I used is

           stmt = "LOAD DATA INFILE '" + fileToLoad + "' REPLACE INTO
TABLE " +

                    tn  + " (id, value, charSet)";      

 

The result of the above action is.

| 105577247 |   NULL |      NULL |     NULL | NULL | MAILSLOTBROWSE
|       4 | NULL      |   NULL |      NULL

 

My requirement is to update only the specified columns. Is it possible
using LOAD DATA INFILE command?

 

Any help will be greatly appreciated.

 

Thanks,

Ila.

      


-- 
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:    http://lists.mysql.com/[email protected]