We help IT Professionals succeed at work.
Get Started

SSIS package to To load a text file( with different delimiters) :

1,364 Views
Last Modified: 2013-11-18
Below is the sample record of  the text file.

BrackleyDE  CCND819BXRJ  CCND819BXRJ (v2.000) (CVCV0FL21/27005 201), start Thu 4/14 11:13 (linger: 2514180) -  adskflex - 64400AMECH_PP_F:  (Total of 64 licenses issued;  Total of 30 licenses in use)

--highighed fields required

The above is the row in text file.

1st delimiter is comma(see above: bolded )
Now, we have
Col1: BdrakeEX CMUNX9BXRJ  CCN41RGJLK (v2.000) (CVCV0FL21/2700501)
Col2 -- start Thu 4/14 11:13 (linger: 2514180) -  akmadas - AASDASMECH_AA_C:  (Total of 4 licenses issued;  Total of 3 licenses in use)
- required fields bolded.
I have the above record in a flat file and i need to parse the required fields into a table.I have to further split column using space delimited for COL1 --as shown above, I only want few fields from COL1. which I bolded above.
The same with the COL2. here it is dash delimited and colon Delimited
I know this can be done by adding a SCRIPT TASK in DATAFLOW of  SSIS package.

Can any one give me        C# code or .vb code to parse this into different columns of script task…which I will eventually put into a sql destination tables.
 OR else can anyone give me the script (using string functions in SSIS derived column tsak)
Col1:  BdrakeEX  CMUNX9BXRJ  CCN41RGJLK (v2.000) (CVCV0FL21/2700501)

To extract above three bolded text fields individually      

Col2 -- start Thu 4/14 11:13 (linger: 2514180) -  akmadas - AASDASMECH_AA_C:  (Total of 4 licenses issued;  Total of 3 licenses in use)

To extract above two bolded text fields individually      
OR please suggest transformations in tsql to do this.(If I stage this data as a single record in to a table on sql server)

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE