Solved

SSIS Expression FileName

Posted on 2014-03-03
2
269 Views
Last Modified: 2014-11-21
I’ve created a variable called strFileName as below with the following expression

substring(@[User::strFileName], 1, FINDSTRING(@[User::strFileName], "Test", 1)-2)
####_#########_#######_###_######_Test_18-1-2014.csv

Which works fine and returns the file name but the problem is the file name changes tomorrow it could be

####_#########_#######_###_######_Test_19-1-2014.csv or
####_#########_#######_###_######_Test_18-10-2014.csv

So what I need to do is extract the last part of the filename and add it to my expression.
If I get the total length of the filename, then from the left get the first 34 characters.
0
Comment
Question by:aneilg
2 Comments
 
LVL 29

Accepted Solution

by:
fibo earned 385 total points
Comment Utility
- You have the filename in string
- You want to extract the part that starts at the 35th character (position 34 if starting at 0)

Is that correct?

If so, then I presume that
substring(@[User::strFileName], 35,length(@[User::strFileName]))
should do the trick (note that "extracting more characters" than there are in the string is OK and will return gracefully the expected result)
0
 

Author Comment

by:aneilg
Comment Utility
thanks. i'll give it a go.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now