Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Importing CSV files

forums forums SQLyog SQLyog Comments Importing CSV files

  • This topic is empty.
Viewing 3 reply threads
  • Author
    Posts
    • #8191
      prav5110
      Member

      HI GUys,

      I am trying to import a csv file comprising >120000 rows. I am not able to import it to a table in mysql. I am using the following command load data infile 'e:\book1.csv' into table tbltest fields terminated by ',' enclosed by '”' lines terminated by 'rn';

      I can break the file in parts and import it but am not able to import it at once. Could you help?

    • #15001
      Shadow
      Member

      Did MySql return any error message when trying to import the file as whole?

    • #15002
      bullshead
      Member

      I too am trying to import a csv file, but size is not the issue, it's interpreting the import parameters.

      If I do Ctrl-Shift-M to fire up the import from CSV dialogue, it translates this into

      load data infile 'path:filename.csv' into table tblname fields terminated by ',' enclosed by '”' lines terminated by 'rn';

      The problem is that I am getting weird results. The CSV is BOG standard eg.

      123456,”Mr”,”John”,”Smith”…

      but depending on how I tweak the parameters it either imports every other record or something else daft. I have sort of got it to work by getting rid of the enclosing double-quotes, but I shouldn't have to do this.

      One question, which I guess I should know the answer to having used PCs since 1981 is where do I find what

      t

      n

      r

      all mean?

    • #15003
      Shadow
      Member

      You should check the “Optionally” option at “Fields enclosed by” because the numeric fields are not enclosed by “-character.

      n = new line (Unix style line break)

      rn = CR LF (Win style line break)

      t = tab (not sure, though…)

Viewing 3 reply threads
  • You must be logged in to reply to this topic.