4

How can I create a condition in SSIS like below?
I know how to create it just in SQL Server

Example:

IIF(LEFT(MAT,1) = '"', NULL,  REPLACE(MAT,'""',''))
Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
Everton Gomes
  • 161
  • 1
  • 1
  • 9
  • 3
    You can use an derived column task. There you can write something like `LEFT(MAT,1) == '"' ? NULL : REPLACE(MAT,'""','')` – SqlKindaGuy Oct 18 '17 at 21:20

3 Answers3

5

«boolean_expression» ? «when_true» : «when_false»

LEN([Mobile]) == 9 ? ("0" + [Mobile]) : [Mobile]

Hosni Mrizek
  • 51
  • 1
  • 2
1

SET MAT = LEFT(MAT,1) == '"' ? NULL : REPLACE(MAT,'""','');

IFF statement works condition-based assignment

The IIF() statement has the following format:

=IIF( Expression to evaluate,
         what-to-do when the expression is true,
         what-to-do when the expression is false )
  • Parameter1: It should be a Boolean Expression.
  • Paremeter2: This value will return when Expression is true.
  • Paremeter3: This value will return when Expression is false.
Jayakumar Thangavel
  • 1,884
  • 1
  • 22
  • 29
-1

The syntax in SSIS is like this: [condition] : [value if true] ? [value if false] With that said, you could do...

(MAT,1)='' : NULL ? REPLACE(MAT,'""',''))

CodyMR
  • 415
  • 4
  • 17
Eric Hanson
  • 47
  • 10
  • its dobble equal sign in derived colum - This is how you write it . Just like i started in comment: Example is `AnimalName == "Elephant"? "savannah": "unknown"` – SqlKindaGuy Oct 18 '17 at 21:17