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

Erik Johnson picture Erik Johnson · Jun 27, 2013 · Viewed 16.9k times · Source

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???

Answer

Max Robbertze picture Max Robbertze · Jul 6, 2015

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.