Reputation: 201
I am trying to convert "Derived Columns" Expressions to SQL statements to be able to add and replace column values and names.
I am having some issues in finding the correct help to understand nested formulas in SSIS.
Formula i have in SSIS is,
[A] == 0 || ISNULL([A]) ? -1 : [A]
How do i write this in a SQL statement?
Upvotes: 3
Views: 95
Reputation: 37313
You can use the ISNULL()
function
CASE ISNULL([A],0) WHEN 0 THEN -1 ELSE [A] END
Or
CASE WHEN [A] IS NULL THEN 0
WHEN [A] = 0 THEN 0
ELSE [A] END
Upvotes: 1
Reputation: 12309
Some thing like this
CASE WHEN [A] = 0 OR [A] IS NULL THEN -1 ELSE [A] END
Upvotes: 1