[PHP-DB] Bulk Insert from text file

2008-09-23 Thread Nasreen Laghari
Hi All,

I have bulk data store in text file, which is attached with this email. Could 
any 1 please help on how to insert using phpMyAdmin??

I tried using below code but getting "Error in SQL Syntax":

BULK 
INSERT venue  FROM 'c:\venues.txt' 
WITH
(   FIELDTERMINATOR = '","')



Any help will be appreciated.



Regards,


Nasreen


  

Re: [PHP-DB] Bulk Insert from text file

2008-09-24 Thread Chris

Nasreen Laghari wrote:

Hi All,

I have bulk data store in text file, which is attached with this email.


Attachments never come through to the php mailing list(s). If anyone 
asks for an attachment, place it somewhere on a website and provide a link.


 Could any 1 please help on how to insert using phpMyAdmin??


I tried using below code but getting "Error in SQL Syntax":

BULK 
INSERT venue  FROM 'c:\venues.txt' 
WITH

(   FIELDTERMINATOR = '","')


http://dev.mysql.com/doc/refman/5.0/en/load-data.html

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Bulk Insert from text file

2008-09-25 Thread Niel Archer
Hi

>   Could any 1 please help on how to insert using phpMyAdmin??

I haven't used phpMyAdmin in years, but here's how I'd do it in SQL with
my favourite tool (SQLyog)

LOAD DATA LOCAL INFILE 'C:\file_name.txt'
 INTO TABLE tbl_name
  FIELDS TERMINATED BY '\t'
  LINES TERMINATED BY '\n'
 IGNORE 1 LINES
 (col_name1, col_name2, col_name3);

Some things to note.
1) the LOCAL keyword is for a file on YOUR computer.  Remove it if the
file is located on the server.  Many shared hosting packages do not
allow you to use LOCAL.

2) IGNORE 1 LINES assumes your file has column names or similar in the
first line, and ignores them. Remove if the file does not have any, or
increase the number if more than one non-data line at the start.

3) The two TERMINATED clauses define the line as being newline
terminated and fields separated by tabs.  Change these accordingly.  You
may need to add an extra backslash  to escape the backslash for
phpMyAdmin, I do not remember how that works with phpMyAdmin.

--
Niel Archer



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php