Solved

SSIS Expression FileName

Posted on 2014-03-03
2
275 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
ID: 39902478
- 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
ID: 39925768
thanks. i'll give it a go.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pivot not using aggregate yield error 3 42
Query syntax 10 40
My Query is not giving correct result. Please help 5 30
Updating a table from a temp table 4 29
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

895 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

17 Experts available now in Live!

Get 1:1 Help Now