LOAD DATA INFILE problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seshu
    New Member
    • Nov 2006
    • 156

    LOAD DATA INFILE problem

    Hi Everybody
    this is seshu here i have doubt
    I have a piece of code to insert data into table which is there in a txt file
    and this is the code
    LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;
    now is it possible load data from a excel file if so how i tried this but this is not working
    some one help me out
    regards
    seshu
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You have 2 different question in the same thread. Therefore I have split this thread.

    moderator

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      You'd have to provide more information. A statement like 'it does not work' is not enough to investigate.

      So show your text data structure, your table structure and your SQL statement, and when you do: put the code within code or php tags!

      Ronald :cool:

      Comment

      • seshu
        New Member
        • Nov 2006
        • 156

        #4
        NO NO What the query i gave there is very much correct it should be filled with table name and the text file which is to be imported into

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          What NO NO? I didn't say your query is incorrect, I only want to see the table defs and some excel data involved. You want the answer, you provide the means.

          Ronald :cool:

          Comment

          • subash
            New Member
            • Sep 2006
            • 32

            #6
            Hi Seshu - provide some example data contains atleast 5 records and the table structure - so that we can easily answer the question

            Subash :)

            Comment

            • seshu
              New Member
              • Nov 2006
              • 156

              #7
              ok sir here is the data
              of my excell table ny excel sheet contains 5 columns
              column 1 name
              column 2 age
              column 3 fateher name
              column 3 mother name
              column 4 maternal status
              now in my back end also there is a simmilar table with 5 columns
              column 1 name --daatype varchar
              column 2 age--daatype varchar
              column 3 fateher name--daatype varchar
              column 3 mother name--daatype varchar
              column 4 maternal status --daatype varchar
              now how to export these 5 columns of excell sheet to mysql datbase,table
              and the code i have is LOAD DATA LOCAL INFILE 'sehsu.xls' INTO table userdetails;
              regards
              seshu

              Comment

              • vpmurdan
                New Member
                • Feb 2007
                • 25

                #8
                I think LOAD DATA command can import only text files, at least up to MySQL4.17.
                Even the extension of the file has to be .txt

                I once tried to import a text file with extension .dat, the load failed.

                So may be you will have to generate a text file, and use an appropriate field separator from the excel file before importing.

                Comment

                • seshu
                  New Member
                  • Nov 2006
                  • 156

                  #9
                  ok then i will import only the text file but the problem in importing the text file is in my table the last column is status there in status after the word i am able see a small box and these boxes are because of the enter key after every line in my text file and these boxes are seen only in last column so the reason i have concluded so
                  i think iam clear if not i dont mine explaining again but i would like to know the solution
                  regards
                  seshu

                  Comment

                  Working...