Wednesday, October 22, 2014

SQL Server Integration Service - NULL Values

Scenario:
I had a scenario where I will get the AD export in CSV format with two columns (samaccountname, GUID) and I had to check if the GUID is null then put the value "0" instead of null value.

Solution:
1. Load the CSV file into SSIS project
2. Make data connection.
3. Add the script component.

4. Edit the Script and overwrite the following function:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    if (Row.GUID_Input.Length > 0)
    {
        Row.GUID_Output = Row.GUID_Input;
    }
    else
    {
        Row.GUID_Output = "0";
    }

}

Knowledge Chat Bot (No Code)

Recently my customers was looking for a solution where on-field guys can search for answers related to their tasks and it was a perfect scen...