I have a fully qulified file name (file name with path) coming into staging table in SSIS load. File name is eg.
C:\SSIS\scripts\work\input\tom_22082017-093346-906838.csv
C:\SSIS\scripts\work\input\jim_22082017-093346-906838.csv
I would like extract only the file name from this and genereate a new column using a case logic in SSIS derived column transformation. Using pure SQL I could do this like:
SELECT CASE
WHEN SUBSTRING(UPPER(RIGHT(filename, CHARINDEX('\', REVERSE(filename)) - 1)), 1, 3) = 'TOM' THEN 'TOMMY'
WHEN SUBSTRING(UPPER(RIGHT(filename, CHARINDEX('\', REVERSE(filename)) - 1)), 1, 3) = 'JIM' THEN 'JIMMY'
END AS PERSON
FROM mystagingtable
How to convert this logic to SSIS Expression language in Derived Column Transformation?