Re: Problem on Load Data into Specific Fields of a table?

From: Date: Mon, 06 May 2002 10:10:43 +0000
Subject: Re: Problem on Load Data into Specific Fields of a table?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18981@lists.php.net to get a copy of this message
In article <20020506043955.94780.qmail@pb1.pair.com>, nedcor4@nedcor.com.hk says... > Dear all > > Two Question : > 1. > I know that the 'LOAD DATA' command loads a bulk of data into a table, but > what happen if i only want to load the data into specifc fields on a table > instead of whole table. > > eg. > Let say i had a file with 3 column of data, and i want to load these data > into a 'ABC' table's field 3 to 5 and leave field 1 & 2 as it was! The LOAD DATA comand can do this: from the mysql docs: The following example loads all columns of the persondata table: mysql> LOAD DATA INFILE 'persondata.txt' INTO TABLE persondata; No eld list is speci ed, so LOAD DATA INFILE expects input rows to contain a eld for each table column. The default FIELDS and LINES values are used. If you wish to load only some of a table's columns, specify a eld list: mysql> LOAD DATA INFILE 'persondata.txt' INTO TABLE persondata (col1,col2,...); Check the mysql docs for more info. > > 2. > I copied a file into server's root directory, and i was trying to load that > file's data to table which i had failed using the following command in > MYSQL: > "LOAD DATA infile 'c:\hkd_rate.csv' into table hkd_deposit1 fields > terminated by ',' " > It said couldn't find the file! > but if i put the file into the data directory of mysql, then it can find it! > So what should i do if i want mysql will able to find that file from root > directory? Again, this is covered in the documentation. -- David Robley Temporary Kiwi! Quod subigo farinam

« previous php.db (#18981) next »