Insert txt file data in to my sql

Discussion in 'MySQL' started by samindika, Dec 11, 2008.

  1. #1
    Please some one help me to insert following rows in to mysql

    I have attache txt file.
    Please insert it in to mysql and give me the sql.

    If you can please tell me how to do it

    Thanks
     

    Attached Files:

    samindika, Dec 11, 2008 IP
  2. Lexiseek

    Lexiseek Banned

    Messages:
    2,499
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sure thing. You need to substitute the field for the right one.

    
    LOAD DATA INFILE 'data.txt'
            INTO TABLE jokes
            FIELDS TERMINATED BY '\n'
      (joke);
    
    Code (markup):

    Where it says insert into "jokes" change that to the name of the DB. at the bottom where it says "joke" change that to the correct table name.

    Make sure the data.txt is in the current directory, or specify the entire path.
     
    Lexiseek, Dec 11, 2008 IP
  3. Lexiseek

    Lexiseek Banned

    Messages:
    2,499
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here, since you seem quite lazy :)
     

    Attached Files:

    Lexiseek, Dec 11, 2008 IP
    samindika likes this.
  4. samindika

    samindika Active Member

    Messages:
    336
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    thanks a lot Lexiseek !
    I added rep to you again thanks.........
     
    samindika, Dec 11, 2008 IP
  5. Lexiseek

    Lexiseek Banned

    Messages:
    2,499
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No problem, man. Enjoy it :)
     
    Lexiseek, Dec 11, 2008 IP