Solved

SSIS Expression

Posted on 2010-09-12
3
358 Views
Last Modified: 2012-05-10
Hi Guys,

 

Input: ProductCatalog_181416_20100513010253_2010517_22715_2010715_172740

Expression Used: SUBSTRING(@[User::FileName], FINDSTRING(@[User::FileName], "_", 1) + 1, FINDSTRING(@[User::FileName],"_",3) - FINDSTRING(@[User::FileName],"_",1)-1)

Output Getting: 181416_20100513010253

 

Out Put Required : 181416_20100513

 

Can please help he out how to get above output.

 

Thanks,
0
Comment
Question by:Dreamslogic
  • 2
3 Comments
 
LVL 39

Expert Comment

by:appari
ID: 33659237
is it always same format between 2nd and 3rd occurances of "_"?
if so try
SUBSTRING(@[User::FileName], FINDSTRING(@[User::FileName], "_", 1) + 1, FINDSTRING(@[User::FileName],"_",3) - FINDSTRING(@[User::FileName],"_",1)-7)
0
 

Author Comment

by:Dreamslogic
ID: 33659248
No thats not the same it changes. Here are the examples

ProductCatalog_141199_20100527164603.CSV_201069_20144_2010625_191748_2010714_142617

ProductCatalog_132700_20100706024658.CSV_2010710_185129

ProductCatalog_182404_03072008_201077_201082_05439

Output Required example:

141199_20100527
132700_20100706
182404_03072008

0
 
LVL 39

Accepted Solution

by:
appari earned 500 total points
ID: 33659266
OK, can we take it as  8 characters after 2nd occurance of "_" is fixed?

if that is the case try

SUBSTRING(@[User::FileName], FINDSTRING(@[User::FileName], "_", 1) + 1, FINDSTRING(@[User::FileName],"_",2) - FINDSTRING(@[User::FileName],"_",1)+7)
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

911 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

19 Experts available now in Live!

Get 1:1 Help Now