Solved

SSIS Expression

Posted on 2010-09-12
3
350 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 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

13 Experts available now in Live!

Get 1:1 Help Now