I am making a table that absorbs values from a csv file. I have several numeric columns and when converting text to number, when inserting values, I get an error.
I have NULL values in the csv. Is there a way to remove them from the database. I remove them manually.
NULL -> '0'.
I tried DEFAULT. ISNULL, I don't know if I can use it when creating a table. What I want to try is not to open the csv anymore. This way I get it. And when importing to the database, the NULLs go to zero.
I receive the files in csv. I open them, remove the NULL values.
7939102772 2401679 108271 0 3000062862 174529 8129
7939102772 2401679 108271 0 3000062862 174529 8129
7939102772 2401679 108271 0 3000062862 174529 8129
1. NULL NULL NULL NULL NULL NULL NULL
And I use:
BULK INSERT [dbo]
FROM 'C:csv'
WITH (FIRSTROW = 2, FIELDTERMINATOR = ',', ROWTERMINATOR='\n');