[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SSIS Expression FileName

Posted on 2014-03-03
2
Medium Priority
?
351 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 1155 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
What we learned in Webroot's webinar on multi-vector protection.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

834 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