Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SSIS Edit Flat Flie Source

Posted on 2012-03-28
14
Medium Priority
?
461 Views
Last Modified: 2012-04-02
Is there a way to edit a FIXED flat file source, I need to trim 14 characters to the left before it goes to the destination.
0
Comment
Question by:decoded
[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
  • 6
  • 6
  • 2
14 Comments
 
LVL 1

Expert Comment

by:mikho
ID: 37779292
If you are familiar with .Net the easiest way to do this would be to create a "Transformation" script component and use code to strip the characters from the file .
0
 

Author Comment

by:decoded
ID: 37779307
Not really...would you give me some help.
0
 
LVL 1

Expert Comment

by:mikho
ID: 37779322
I dont code .Net myself :) , I only know its possible to do...

You could try to add a column with the 14 chars that you want to remove...
I think its in under the advanced settings on the task...

I'm not on my developer computer now so I cant check
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:decoded
ID: 37779392
i dont think that would work. that would change the rows
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 37779712
Hi,
Can you show an example of what you need to do, like a source and expected results? I don't get what do you say by FIXED flat file source, I need to trim 14 characters to the left before it goes to the destination.

Thanks
Jason
0
 

Author Comment

by:decoded
ID: 37779944
Attahed is what I mean by fixed width.

but what i am try to remove is the first 14 characters of a file:

"date=20120213" 12364 xxxxx971 898  2645   567wr

in quotes the first 14 characters.

fixed file
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 37779980
Oh, OK...so what's the problem then? just ignore the first 14 chars when you insert into your final destination.

or you can even read each row as ONE column, then use  a derived column to remove the first 14 chars

see attached
result.jpg
DCT.jpg
0
 

Author Comment

by:decoded
ID: 37780006
The problem is that I need the first 14 characters of the first row only.
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 37781401
oh I thought the opposite!!

then use expression substring(column, 1,14)  and that will get you the first 14 chars.
0
 

Author Comment

by:decoded
ID: 37781775
This works however, its remove characters for all the rows.
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 37781864
isn't that what you need ? or what's your actual requirement?
0
 

Author Comment

by:decoded
ID: 37783207
attached is what i need to remove.

what need to be erase
i just need to remove whats highlighted then import into another text file.
0
 
LVL 21

Accepted Solution

by:
Jason Yousef, MS earned 2000 total points
ID: 37783316
OK, I think we could add a script task to create a row number and in the derived column we could use:     rownum ==1 ? substring(column,14,len(column)) : column

use the same example here: http://asqlb.blogspot.com/2011/05/ssis-selective-rows-count-using-script.html to create the counter

let me know if you need more help.
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 37786818
how is this working out for you? any questions?

If you're stuck, send me a sample data file and I'll create a sample package for you...

regards,
Jason
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

715 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