I've the fololwing transformation in T-SQL:
SELECT [FIELD_A] = case when CHARINDEX('-', FIELD_B)>0 then LEFT(FIELD_B,CHARINDEX('-', FIELD_B)-1)
else FIELD_B end,
How can I put this into a expression in Derived Column object using SQL Server Integration Services 2014?
Regards!!!
Derived Column transformations use SSIS Expression syntax. The syntax for this would work something like this:
FINDSTRING(FIELD_B, "-", 1) > 0 ? LEFT(FIELD_B, FINDSTRING(FIELD_B, "-", 1)-1) : FIELD_B
I haven't tested it, but it should get you going down the right path. To walk through it:
Findstring reference: https://learn.microsoft.com/en-us/sql/integration-services/expressions/findstring-ssis-expression
Conditional reference: https://learn.microsoft.com/en-us/sql/integration-services/expressions/conditional-ssis-expression