Search code examples
sql-servercsvnullssmsflat-file

NULLs when importing flat file - SQL Server


I am trying to import some data from a .csv file in SSMS using the "Import Flat File" option. However, not all the data is being copied.

Both data types are set to nvarchar(50).

The lines containing just a single value after the semi-colon is imported. Lines with multiple values are imported as NULL. I've tried separating the values with forward slashes and commas. The result is still the same.

How can I get the values imported instead of these NULL values?

enter image description here


Solution

  • I tested on my local machine with your example and everything is ok.

    Maybe there is an issue in your flat file, have you checked your file is coherent (appropriate < CR >< LF > for example) in Notepad++ ?

    Also, during the import, Is the result you see in the "preview" window correct ?