SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi!
    I've got problems inserting textfiles into a column in a MySQL table. It's only the first line that's inserted.
    How should i write the command so that the linebrakes are included?
    As it is now, I'm using
    LOAD DATA LOCAL INFILE 'C:\loggar\log1.txt' INTO TABLE logs FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FIELD(text);

    hope you understand what i mean, I'm a no gooder in english
    //Magnus

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LOAD DATA LOCAL INFILE 'C:\loggar\log1.txt' INTO TABLE logs FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED BY '\\' LINES TERMINATED BY "\n" FIELD(text);

    that should do the trick for you, notice the " round \n.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Karl
    I found another way...

    LOAD DATA LOCAL INFILE 'C:\loggar\log1.txt' INTO TABLE logs FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED BY '\\' LINES TERMINATED BY "666" (text);

    the 666 or whatever number is included as the las chars in the text file.



Bookmarks

Posting Permissions

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