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";
    }

}

No comments:

Post a Comment

Official SharePoint Documentation

I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...