Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server Import Wizard treats NULL as literal string 'NULL'

When I attempt to import a .csv comma-delimited flat file into a Microsoft SQL server 2008R2 64-bit instance, for string columns a NULL in the original data becomes a literal string "NULL" and in a numeric column I receive an import error. Can anyone please help???

like image 350
Erik Johnson Avatar asked Dec 12 '22 13:12

Erik Johnson


1 Answers

KISS

Pre-process it, Replace all "NULL" with "".

ie the .csv file will have

,,

Instead of

NULL,NULL,

Seems to do the job for me.

like image 194
Max Robbertze Avatar answered Feb 19 '23 14:02

Max Robbertze