July 16, 2009 at 8:02 am
Hi,
I want to read a file and insert data into a table. The file has no delimiters or spaces.
Its a fixed length file.
For example
001Riya#234abcstreetAtlantaGA60020
002Rina#876defstreetAltantaGA60020
According to my knowlegde, we have to use a script task. Can anyone help me with the script.
or any other idea is also most welcome.
Thanks in advance.
July 16, 2009 at 8:14 am
You should not need a script.
Configure a flat file connection, setting the format to 'fixed width' and then set all your start positions and lengths ...
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 17, 2009 at 11:29 am
Hi Phil,
Thanks for the quick response.
I realized that I will have to use a conditional spilt task, since the records length is fixed for certain records only, which I did not mention in my previos post.
Now, I need to split the single record into column of the table.
for example
H1234NRina
H2345A123abcstreet
H3456Z23456
so above the records are split on the basis of N(Name),A(Address) and Z(zip)
Please help me with the script.
Thanks in advance
July 17, 2009 at 1:53 pm
Another update is that, the 3 records from the flat file will form a single row at the destination (table)
Thanks.
July 17, 2009 at 4:20 pm
It's not possible with the current information because there's nothing to identify the difference between the street and the city.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2009 at 10:49 pm
So N is a Name record, A an Address record, etc?
.. the records length is fixed for certain records only, ...
Please explain what you mean by this and give an example of records which do not have a fixed length.
Other than by proximity in the source file, is there anything in the file which links the associated records? A unique ID, perhaps.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 20, 2009 at 4:11 pm
Hi Phil,
Thanks for the reply.
I figured it out.
I had to use merge join task and implement the same.
July 20, 2009 at 5:27 pm
touchmeknot123 (7/20/2009)
Hi Phil,Thanks for the reply.
I figured it out.
I had to use merge join task and implement the same.
How were you able to split the street name from the city name with no delimiter? :blink:
--Jeff Moden
Change is inevitable... Change for the better is not.
July 21, 2009 at 7:46 am
hey Jeff,
Yes, As I had written earlier that certain records have fixed length.
Like say
H1234NRina
H2345A123abcstreet
H3456Z23456
Above, 1st record "type" i.e. type N will have columns of length 5,1,4 only
Similarly, 2nd one, type A will have 5,1,6,5 only.
I did that with the help of conditional split.
July 21, 2009 at 8:33 am
touchmeknot123 (7/21/2009)
hey Jeff,Yes, As I had written earlier that certain records have fixed length.
Like say
H1234NRina
H2345A123abcstreet
H3456Z23456
Above, 1st record "type" i.e. type N will have columns of length 5,1,4 only
Similarly, 2nd one, type A will have 5,1,6,5 only.
I did that with the help of conditional split.
Undrerstood on those... what I was referring to is how did you split the items in your original post? Specifically, the following items...
001Riya#234abcstreetAtlantaGA60020
002Rina#876defstreetAltantaGA60020
--Jeff Moden
Change is inevitable... Change for the better is not.
July 21, 2009 at 9:02 am
Its possible with the help of 'ragged right' option in the connection manager of the file in general tab. Then switch over to the Columns tab and decide on your column length ( by clicking on the area where you see the columns).
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply