MySQL Workbench Import NULL from CSV

后端 未结 4 1323
不知归路
不知归路 2021-01-12 02:59

I can\'t for the life of me make MySQL Workbench import NULL for blank cells in a CSV.

I\'ve tried:

  • blank
  • NULL
  • \\N
  • Each wi
相关标签:
4条回答
  • 2021-01-12 03:35

    If you were trying to import a CSV into the model for creating insert scripts (where you won't get the same options described in the other answers), try the following:

    \func NULL
    

    You can also use this syntax to call functions like the following to insert the current date time when you forward engineer the model to the database:

    \func CURRENT_TIMESTAMP
    
    0 讨论(0)
  • 2021-01-12 03:36

    Since MySQL Workbench version 8.0.16 (released on 04/25/2019) there has been an additional option for uploading .csv file -- "null and NULL word as SQL keyword". When selecting this option as YES, the NULL expression without quotes in .csv file (,NULL, rather than ,"NULL",) will work for this purpose.

    0 讨论(0)
  • 2021-01-12 03:44

    I suggest switching to Navicat for MySQL -- if only for the csv table import wizard. After repeated attempts to get the MySQLWorkbench Import Wizard to work for my CSV file, I gave up. I recalled using Navicat in an early project and it worked flawlessly. For this import, I was able to load my 15000+ row CSV with multiple null datetime values into my MySQL table without a problem.

    Weird that MySQLWorkbench still hasn't solved this annoyance. But Navicat provides an easy alternative until they do.

    0 讨论(0)
  • 2021-01-12 03:45

    You can solve your problem by updating your workbench to the newest.

    enter image description here

    0 讨论(0)
提交回复
热议问题