how to get second subfolder name out of complete file path with SSIS derived column expression
Hello, I'm using SQL server 2008 standard. I have a table which contains filenames with there complete directory path, e.g. D:\Documents\DepartmentA\finance\bill1.txt I'm building an SSIS package to derive the second folder, but the length of folder names varies. So I think I need to derive the string between the second and third Backslash. How to do this?
July 3rd, 2011 3:49am

Try this in Derived Column SUBSTRING(@[User::Pfad],FINDSTRING(@[User::Pfad],"\\",2) + 1,FINDSTRING(@[User::Pfad],"\\",3) - FINDSTRING(@[User::Pfad],"\\",2) - 1)
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2011 4:22am

Hello Christa, Works almost great! However, sometimes there is no second subfolder, e.g. D:\documents\billsample.txt en then the SSIS packe fails because of this records....So there is no third \... how to handle this?
July 3rd, 2011 7:31am

Best way to handle this is a skript task. Script task is more flexibel, you can do all this things with .net or c# A path is the same over the whole DF so it's not useful to extract the folder for every row. Do it once before DF in script task and pass it to a variable. This variable pass in the derived column as a new column to your rows
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2011 7:40am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics