Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    2

    Question Unanswered: 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

  2. #2
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •