LOAD DATA INFILE

------_=_NextPart_001_01C7B8EE.8A4A5BC4
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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 =3D "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.




------_=_NextPart_001_01C7B8EE.8A4A5BC4--
Ilavajuthy Palanisamy [ Mi, 27 Juni 2007 21:08 ] [ ID #1751046 ]

RE: LOAD DATA INFILE

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:ipalanisamy [at] consentry.com]
Sent: Thursday, 28 June 2007 4:38 AM
To: win32 [at] lists.mysql.com
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 =3D "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/win32?unsub=3Dgcdmw-win32 [at] m.gmane.org
John.Bonnett [ Di, 03 Juli 2007 00:43 ] [ ID #1758438 ]
Datenbanken » gmane.comp.db.mysql.windows » LOAD DATA INFILE

Vorheriges Thema: Access denied for user 'ODBC'@'localhost'
Nächstes Thema: problems