Solved

SSIS Expression FileName

Posted on 2014-03-03
2
304 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
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…

726 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