Re: mysql - load data file question..
can u please show use the content of the test.csv file. Also is "comapny name" a single column or two different columns If its two different columns than try this load data file '/foo/test.csv' into table abc.test fields terminated by ',' (company,name)"; On 6/28/08, bruce <[EMAIL PROTECTED]> wrote: > > Hi.. > > I've got an issue with doing a Load data file" cmd.. > > my test text tbl has a column named "company name" i'm trying to figure out > how to use the load data file cmd, to be able to extract the "company name" > col... > > when i do: > load data file '/foo/test.csv' into table abc.test (company name)"; > load data file '/foo/test.csv' into table abc.test ('company name')"; > > i get errs for both of the above... > > i can get this to work if i have a column with a single name... > > can't find any pointers via google.. > > any pointers/thoughts/etc... > > thanks > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > >
mysql - load data file question..
Hi.. I've got an issue with doing a Load data file" cmd.. my test text tbl has a column named "company name" i'm trying to figure out how to use the load data file cmd, to be able to extract the "company name" col... when i do: load data file '/foo/test.csv' into table abc.test (company name)"; load data file '/foo/test.csv' into table abc.test ('company name')"; i get errs for both of the above... i can get this to work if i have a column with a single name... can't find any pointers via google.. any pointers/thoughts/etc... thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: LOAD DATA FILE
At 19:58 +0300 3/14/03, [EMAIL PROTECTED] wrote: I have strange problem with LOAD DATA INFILE $file="base.txt"; $conn=mysql_connect('localhost', 'user', 'paswd'); mysql_select_db('realestate', $conn); $query="LOAD DATA INFILE '".$file."' REPLACE INTO TABLE table_name FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'"; mysql_query($query, $conn) or print(mysql_error()); mysql_close($conn); Everything seems to be OK, no error messages, but when I open the table I see only new empty row created. What's wrong? My guess would be that because \ in strings is special to both MySQL *and* PHP, you'll need to specify \t and \r\n as \\t and \\r\\n. -- Paul DuBois, [EMAIL PROTECTED] http://www.kitebird.com/ sql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
LOAD DATA FILE
I have strange problem with LOAD DATA INFILE $file="base.txt"; $conn=mysql_connect('localhost', 'user', 'paswd'); mysql_select_db('realestate', $conn); $query="LOAD DATA INFILE '".$file."' REPLACE INTO TABLE table_name FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'"; mysql_query($query, $conn) or print(mysql_error()); mysql_close($conn); Everything seems to be OK, no error messages, but when I open the table I see only new empty row created. What's wrong? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Help On Load Data File
Hi Calvin, Check out http://www.mysql.com/doc/L/O/LOAD_DATA.html and search for "Warnings". A paragraph probably of particular interest to you is: "Warnings occur under the same circumstances as when values are inserted via the INSERT statement (see section 6.4.3 INSERT Syntax), except that LOAD DATA INFILE also generates warnings when there are too few or too many fields in the input row. The warnings are not stored anywhere; the number of warnings can only be used as an indication if everything went well. If you get warnings and want to know exactly why you got them, one way to do this is to use SELECT ... INTO OUTFILE into another file and compare this to your original input file." > -Original Message- > From: Calvin Chin [mailto:[EMAIL PROTECTED]] > Sent: Sunday, October 28, 2001 9:08 PM > To: [EMAIL PROTECTED] > Subject: Help On Load Data File > Importance: High > > > Hi list member, > > I have a slight problem here. I am testing on the data > convertion from > text file into MySQL table. > > I am able to use the 'load data infile' command and insert > the data into > the table, however, with 1000 warnings. I don't know where I > can see the > warning messages ? > > Can you people help me to identify where MySQL store the > warning / error > messages generated? > > Thank you. > > Regards, > Calvin Chin > [EMAIL PROTECTED] > Ipmuda Berhad - Building materials for a better world ! > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Help On Load Data File
Hi list member, I have a slight problem here. I am testing on the data convertion from text file into MySQL table. I am able to use the 'load data infile' command and insert the data into the table, however, with 1000 warnings. I don't know where I can see the warning messages ? Can you people help me to identify where MySQL store the warning / error messages generated? Thank you. Regards, Calvin Chin [EMAIL PROTECTED] Ipmuda Berhad - Building materials for a better world ! - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php