显示标签为“spaces”的博文。显示所有博文
显示标签为“spaces”的博文。显示所有博文

2012年3月25日星期日

Flat File Source Queston

I want to read the following file using the Flat File Source flow:

10000 Router
20000 Hub
10000 Switch
30000 Server
40000 Harddisk

Spaces are used between the numbers (e.g. 10000) and the following text (e.g. Router). Each line is temrinated by a {CR}{LF} pair. I would normally think of this as a "fixed width" file.

But in the Flat File connection manager, if I use format "Fixed width", the preview shows a row width of 1 character wide (the first row contains the number "1"; the next row contains "0", and so on for the remaining 3 rows.in the first line) Not what I had in mind. How do I setup SSIS to handle this file in intended maner?

TIA,

Barker

P.S. I never had any trouble with this type of file under Sql 2000 DTS. Also, have you noticed the crappy-looking "bitmap" displayed when one wants to click and define columns for a fixed-width file?

I might add that using "Fixed width" format I can successfully parse the columns: "Column 0" contains the digits; "Column 1" contains the spaces between the digits and the text; "Column 2" contains the text itself and "Column 3" contains the <CR><LF> line terminators. I'm sure I'm missing the point as this seems like a lot of work for something that should be very straightforward.

barker

|||

I'm beginning to think that "ragged right" is the preferred format. That format allows for fixed-width columns but assumes that last column has variable width (and is terminated). In other words, ragged right recognizes the line terminator as exactly that and doesn't think of it as another character(s) to be parsed.

Barker

|||

You've got it right. The RaggedRight seems as the most appropriate format for your file.

Thanks.

2012年3月22日星期四

Flat File created but with too many spaces

My Flat File connection manager is creating a flat file that has way too many spaces between my fields. I am exporting columns from a table which in the end should only produce a fixed length flat file of 100 bytes but there are a ton of spaces between the columns for some reason.

http://www.photopizzaz.biz/junk/4.jpg

http://www.photopizzaz.biz/junk/7.jpg

You're using fixed width and likely the default width, which is 50 characters. You might want to switch to delimited or use a smaller fixed width.|||thanks much, found it.