If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > loading table with .txt file wont work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-13-04, 14:38
remvs remvs is offline
Registered User
 
Join Date: Jul 2004
Posts: 2
Question loading table with .txt file wont work

HI all,

i'm trying to load a textfile into a tabel (called login) with this sql-string:

load data local infile 'C:\\login.txt' into table login(login,pwd) LINES TERMINATED BY '\r\n';

But all i get is an error saying that i have a typo in my SQL string.

Weird thing is that when i remove the ' (login,pwd) part, it WILL read it, but then the tables are all wrong (coz i also have an autoincrement in first column)

Any tips please?!

Thanks in advance!
Remvs
Reply With Quote
  #2 (permalink)  
Old 07-14-04, 11:32
1andyw 1andyw is offline
Registered User
 
Join Date: Mar 2004
Location: Erie, PA
Posts: 8
remvs,

This sequence has worked for me:

LOAD DATA LOCAL INFILE file.txt
INTO TABLE contacts
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(name,address,city,state,zip,phone);

Good luck,

Andy
Reply With Quote
  #3 (permalink)  
Old 07-14-04, 16:05
remvs remvs is offline
Registered User
 
Join Date: Jul 2004
Posts: 2
Andy,

YES! that was the problem!
The part '(name,pwd)' needed to go at the end of the string (like your example)

Thanks alot!!
Remvs
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On