LOAD DATA INFILE

LOAD DATA INFILE

am 27.06.2007 21:08:26 von Ilavajuthy Palanisamy

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

Hi,

=20

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?

=20

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

=20

The command that I used is

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

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

=20

The result of the above action is.

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

=20

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

=20

Any help will be greatly appreciated.

=20

Thanks,

Ila.

=20


------_=_NextPart_001_01C7B8EE.8A4A5BC4--

RE: LOAD DATA INFILE

am 03.07.2007 00:43:40 von John.Bonnett

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@consentry.com]=20
Sent: Thursday, 28 June 2007 4:38 AM
To: win32@lists.mysql.com
Subject: LOAD DATA INFILE

Hi,

=20

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?

=20

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

=20

The command that I used is

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

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

=20

The result of the above action is.

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

=20

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

=20

Any help will be greatly appreciated.

=20

Thanks,

Ila.

=20


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org