Solved

SSIS Expression

Posted on 2010-09-12
3
363 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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

680 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