April 7, 2015 at 3:46 am
Hi,
I am having variable in ssis package which is used to store the filepath with file name in sql table.
I want to give only filename to another variable using expression
another variable is V_Src_Filename
V_Flatfilename=\\RLDEVOLP04\IncomingFiles\TESTFILES\FBDET_ZZ_150402054946.txt
my output should be like FBDET_ZZ
using below logic
SUBSTRING(FileName,38,LEN(FileName)-54)
suggeste correct expression ,
thanks & regards,
Vipin jha
April 7, 2015 at 5:06 am
You need the position of the final backslash and the final underscore and to take everything between the two. You can get the position by reversing the string and looking for the first occurrence. You'll end up with quite a complicated expression, but if you do it bit by bit, you should be able to work it out. Good luck!
John
April 7, 2015 at 5:47 am
The final string can be obtained like this
TOKEN("\\\\RLDEVOLP04\\IncomingFiles\\TESTFILES\\FBDET_ZZ_150402054946.txt", "\\",4)
... You can use a combination of findstring and substring to do the rest.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply