Blog Post

SQL Server SSIS: ReplaceNull

,

One of widespread problems in SSIS packages is to replace NULL values with some specific value. Unfortunately, before it was not a simple task as Integration Services didn’t have the operator similar to ISNULL () in T-SQL. To be more exact, there was such an operator, but it works in a slightly different way.
SSIS ISNULL function  returns the result in the form of a logical expression, depending on whether the expression value is NULL.

Therefore to cope with the task in which the main requirement was to process NULL values and display 0 (zero) instead of them the following script was used:

(ISNULL(OpPriceAir) ? (DT_CY)0 : OpPriceAir) + (ISNULL(OpPriceExt) ? (DT_CY)0 : OpPriceExt)

SSIS1

 

The situation changed when SQL Server 2012 was released: a new operator REPLACENULL appeared in SSIS. And now the same problem is solved as follows:

REPLACENULL(OpPriceAir,0) + REPLACENULL(OpPriceExt,0)

SSIS2

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating