MySQL LOAD DATA INFILE: works, but unpredictable line terminator

前端 未结 7 909
走了就别回头了
走了就别回头了 2020-12-25 14:58

MySQL has a nice CSV import function LOAD DATA INFILE.

I have a large dataset that needs to be imported from CSV on a regular basis, so this feature is

7条回答
  •  無奈伤痛
    2020-12-25 15:39

    If the first load has 0 rows, do the same statement with the other line terminator. This should be do-able with some basic counting logic.

    At least it stays all in SQL, and if it works the first time you win. And could cause less headache that re-scanning all the rows and removing a particular character.

提交回复
热议问题