This SSIS Integration Services article shows how to load blank or empty spaces in theft file data as the NULL values to the SQL Server table with an example. To demonstrate this package, we use the Employee Employees Nulls text file that we generated previously. It has few empty or blank spaces.
Drag and drop the Data Flow Task into the control flow region.
SSIS Load Flat File Blank spaces as SQL Server Nulls
Double-click to open the SSIS Data Flow Region. Then, drag the flat file source and double-click on it to open the Source Editor. Next, click the New button to open the Flat File Connection Manager Editor window.
Click the Browse button to choose the Employee text file with a few Empty spaces.
If the file’s first row has header names, checkmark the Column Names in the first data row option.
Within the Column tab, check the columns and rows and change the Column Delimiter (if needed).
Use the advanced section to change the Data type, as they have to match with the destination table; otherwise, it throws an error.
Next, checkmark the Retain null values from their source as the null values in the data flow option and click OK to close the window.
Drag the OLE DB Destination and double-click on it to open the Editor. Next, click the New button to configure the OLE DB Connection Manager. Here, we have chosen the existing one.
Select the Load Data with Nulls table from the list. If not, click the new button to create a new one.
Next, go to the Mappings tab to check the input and available destination column mapping.
Run the SSIS Load Flat File Blank spaces as SQL Server Nulls package.
Open the SQL Management Studio to check whether NULLs replace blank spaces or values.