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

2012年3月29日星期四

Flummoxed by Connection Problem

Everything was working fine until suddenly this problem appeared from
nowhere:
Boot up the pc and go into SQL Server Management Studio. The database is
present and the data can be accessed.
Go into VB2005 Express and run the project. Everything works fine.
Open Database Explorer and connect to the database and the following
happens:
1. The project no longer works and this error appears at cnn.open()
'Cannot open user default database. Login failed. Login failed for user'
2. The database is no longer available in Management Studio. It appears
but no longer has the little + sign next to it and the data is no longer
accessible. If I try and view the database properties I get this error:
Cannot show requested dialog.
ADDITIONAL INFORMATION:
Cannot show requested dialog. (Microsoft.SqlServer.Express.SqlMgmt)
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
Database 'T:\VS_DATA\NORTHWND.MDF' cannot be opened due to inaccessible
files or insufficient memory or disk space. See the SQL Server errorlog
for details. (Microsoft SQL Server, Error: 945)
The only way I can get out of this situation is to reboot my pc. I am ok
as long as I don't try and connect to the database via Database Explorer.
I have tried disconnecting from and even deleting the database in Database
Explorer to no avail. HELP!
Des
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/I have narrowed down the sequence:
If I close the connection to the database in VB2005 Database Explorer
(very important) and then restart the server my project works again. But
as sonn as I connect vian Database Explorer it breaks again.
On Tue, 17 Jul 2007 12:32:05 +0100, DesCF <descf@.aol.com> wrote:

> Everything was working fine until suddenly this problem appeared from
> nowhere:
> Boot up the pc and go into SQL Server Management Studio. The database
> is present and the data can be accessed.
> Go into VB2005 Express and run the project. Everything works fine.
> Open Database Explorer and connect to the database and the following
> happens:
> 1. The project no longer works and this error appears at cnn.open()
> 'Cannot open user default database. Login failed. Login failed for user'
> 2. The database is no longer available in Management Studio. It appears
> but no longer has the little + sign next to it and the data is no longer
> accessible. If I try and view the database properties I get this error:
> Cannot show requested dialog.
> ADDITIONAL INFORMATION:
> Cannot show requested dialog. (Microsoft.SqlServer.Express.SqlMgmt)
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> Database 'T:\VS_DATA\NORTHWND.MDF' cannot be opened due to inaccessible
> files or insufficient memory or disk space. See the SQL Server errorlog
> for details. (Microsoft SQL Server, Error: 945)
>
> The only way I can get out of this situation is to reboot my pc. I am
> ok as long as I don't try and connect to the database via Database
> Explorer. I have tried disconnecting from and even deleting the
> database in Database Explorer to no avail. HELP!
>
>
> Des
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

2012年3月26日星期一

FlatFile connection and security

My DTS package, deployed and run from the file system, works just fine for me, but fails when someone else runs it. The only explicit error from the dtexec command is:

Error: 2005-06-24 12:35:03.33
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
End Error

This error just started when we tried to point to a file on a network server instead of a file local to the machine running the package. The other person definitely has access rights to that network server, but the package fails anyway.

One possible solution might be to specify a username/password for the file, but I don't see how to include that in the connection string. Alternatively, this may be a more general security issue with the whole package. I first turned to BOL for some explanations and answers, but wasn't able to find anything specific to my problem.

Any help or suggestions will be greatly appreciated. Thanks!
Phil
This is because the default protection level is to encrypt with a user key. That means only a user on his/her machine can open the package.

You probably want to use Package Password here instead.|||

I am getting a similar error on a DTS package created by me and migrated by me and executed by me via Dtexec. Shouldn't ssql 2000 ownership carry over to 2005? The package is not a flat file. And, by the way, where does the "DTS Property" come in?

thanks

Ted

Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
NULL
Started: 9:24:56 AM
Error: 2006-02-08 09:24:56.50
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error
Error: 2006-02-08 09:24:56.51
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error

|||

SSIS is a completely new product so I don't think it follows that DTS behaviour should make it into SSIS. Furthermore, there's been a very high profile tightening up of security within Microsoft products and the behaviour you're seeing here is probably as a result of that.

The reason you see references to "DTS" in various places is for legacy reasons. Alot of the product had already been built before the name change came about.

-Jamie

sql

FlatFile connection and security

My DTS package, deployed and run from the file system, works just fine for me, but fails when someone else runs it. The only explicit error from the dtexec command is:

Error: 2005-06-24 12:35:03.33
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
End Error

This error just started when we tried to point to a file on a network server instead of a file local to the machine running the package. The other person definitely has access rights to that network server, but the package fails anyway.

One possible solution might be to specify a username/password for the file, but I don't see how to include that in the connection string. Alternatively, this may be a more general security issue with the whole package. I first turned to BOL for some explanations and answers, but wasn't able to find anything specific to my problem.

Any help or suggestions will be greatly appreciated. Thanks!
PhilThis is because the default protection level is to encrypt with a user key. That means only a user on his/her machine can open the package.

You probably want to use Package Password here instead.|||

I am getting a similar error on a DTS package created by me and migrated by me and executed by me via Dtexec. Shouldn't ssql 2000 ownership carry over to 2005? The package is not a flat file. And, by the way, where does the "DTS Property" come in?

thanks

Ted

Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
NULL
Started: 9:24:56 AM
Error: 2006-02-08 09:24:56.50
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error
Error: 2006-02-08 09:24:56.51
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error

|||

SSIS is a completely new product so I don't think it follows that DTS behaviour should make it into SSIS. Furthermore, there's been a very high profile tightening up of security within Microsoft products and the behaviour you're seeing here is probably as a result of that.

The reason you see references to "DTS" in various places is for legacy reasons. Alot of the product had already been built before the name change came about.

-Jamie

2012年3月22日星期四

flat file source and destination - need fixed width output

I have a text file that is comma delimited and im pulling it in with a flatfile connection manager. I want to read some of the data, then output another flat file but in a fixed column width. What settings do I made to the connection manager of the output flatfile ?Choose a fixed-width format when setting up the destination. And then define your columns.|||

Hi

A solution is:

- Go to advanced properties of output flat file.

- Define the fields as text and the property OutputColumnWith with the size you want

- Export your data to that file and convert it to text.

Raul

|||I had some other steps in the middle, so I took them out just to simplify things. In the connection mgr for my destination, it wants to know the input column widths. Should I really need to bother with this, since in the end, I just want whatever output i get during any previous steps, to simply be output to the flat file as fixed width ?|||Ok, ive managed to get my output in fixed width in the output file, but it appears the lines arent terminating where they should be. What controls where the lines terminate ? I dont have a header row (no column names in the first row), so what, if anything should the "header row" settings be set to ?|||Ive got a data file with values seperated with commas. I want to read in this text file, do a lookup and add the lookup column on the front of the other columns and save the output in a fixed width format, similar to what you would get if you saved the query reqults to a file in sql mgt studio.

What I have so far is just a flat file source , a lookup and a flat file destination.

I can get the output to generate, but there doesnt seem to be any row terminating, its all one big string.

help ?|||Use "Fixed width with Row Delimiters" option for the flat file connection manager.|||

Eric Wisdahl wrote:

Use "Fixed width with Row Delimiters" option for the flat file connection manager.

Where is that option available ? Under the general tab on my flat file conn mgr, I have only the options:
"fixed width"
"delimited"
"ragged right"

If I have fixed width selected, and go to the advanced tab, start entering my own columns, the column delimiter option is greyed out.|||When you are first creating the flat file connection manager it gives you the option of delimited, fixed width, fixed width with row delimiters, ragged right. All that fixed width with row delimiters does is add another column to each record which contains the row delimiter. You can accomplish the same thing by adding it in with the derived column and adding it to the end of your output record.

Flat File Destination - File name

Hello,

I'm trying to send a file with FTP.

In the Flat File connection manager I have to write the name of the file.

Is there any way of deciding at runtime what the name of the file should be?

Thank you.

Yes. Use expressions.

http://blogs.conchango.com/jamiethomson/archive/tags/Expressions/default.aspx

-Jamie

|||

Hi Chaps

I am trying to achieve a similar thing with the FTP Task
ie incorporate the date into the filename when sending the file.

I have set IsRemotePathVariable=True


I have created an expression for the RemotePath:
"/FName"+ (DT_WSTR,4)DatePart("yyyy", GetDate())
+ (DT_WSTR,2)DatePart("mm", GetDate())
+ (DT_WSTR,2)DatePart("dd", GetDate())+".txt"

However, an error is produced:
"Error at FTP Task: Failed to lock variable"/FName2007611.txt"

Should I be linking the expression to a variable ?
and if so how

Any guidance would be very much appreciated.

Regards

JohnJames
|||

Hi,

Just so I understand this correctly, do you use a hard coded file name in the Data Flow Flat File Destination (f.ex. outputfile.txt) and then afterwards in the Control Flow you change the file name (f.ex. outputfile_11_06_2007.txt) by using these expressions?

Thank you.

|||Yes

In the Dataflow I am using a hard-coded filename,
to extract data from SQL Server to a flatfile.
In the Control Flow is the FTP Task where I am trying to add
the Date to filename using an expression.

Regards

JohnJames
|||Why don't you create a variable who's value is an expression. You then use the variable in the data flow and the FTP task. That way you are always guaranteed that the file name is correct.
Saves you from having to rename a file as well..|||Thanks Crispin

I'll give a go and let you know

Regards

JohnJames|||

Hi,

I'm trying to decide the filename of my Flat File Destination at run time by using an expression variable.

I created an expression variable:

Name: FileName_Expression Value: C:\test.txt

However, in the Data Flow in Flat File connection manager, I can't seem to put my variable name inside the "File Name" editbox and I have no idea where to put my expression variable.

Any ideas?

Thank you so much!!!

|||

Mr. Hat,

Use the connectionstring property of the flat file connection manager.

ex. ConnectionString = @.[User::myPath] + "\\ERROR_" + @.[User::FileName_Expression]

(Where myPath is something similar to C:\temp)

NOTE: new questions like this should probably get a new thread as many people will just look past the threads which appear to have already been answered.

Hope this helps.

EWisdahl

|||Wow, it worked! Thanks a lot!! Big Smile|||

Hi

when i'm trying to set the file name runtime for excel destination by setting expression

ConnectionString : @.[User::ExcelFullFileName]

but getting below error

Error at Data Flow Task [Excel Destination [7689]]: The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.

please can you advice regarding this?|||I believe (but I may be wrong) that the Excel file needs to exist to be referenced by the Connection Manager.sql

Flat file data types - defined from Table?

This question is around how we can get the data types and lengths populated into the flat file source columns.

In Connection Manager, you have your flat file defined. You can choose "Suggest Types...", and the minimum lengths and correct data types will be returned from within the data in the flat file.

Is there some way to automate this data type definition, but coming from the other direction (coming from the destination table that we are loading)?

For example, you have mapped the columns that will be loaded. Can you then reverse engineer the data types and lengths for the columns in the flat file from the destination table?

TIA

No, not possible. Unless you're going to write your own package using the SSIS API. But then, if you're going to do all of that work, SSIS may not be the best fit after all.|||

Phil

Thanks much for your answer. Maybe I'm not thinking flexibly enough regarding the solution.

It seems the flat file will pretty much default to DT_STR with length of 50 for all columns. Obviously some data could be truncated.

Where I'm trying to head is:

1. Assuming your table is mapped correctly to data types and lengths, would it not be best practice to set the same data types and lengths in your flat file definition? Or...does it matter?

2. Again, back to flexible thinking about the problem and solution. Is there another path that I'm not seeing? Perhaps the definition of data types and lengths for the flat file columns is moot, b/c it is also defined (and overridden) at another point, such as during the mapping or transforms?

Thanks again

|||

Alfred Kokintz wrote:

Phil

Thanks much for your answer. Maybe I'm not thinking flexibly enough regarding the solution.

It seems the flat file will pretty much default to DT_STR with length of 50 for all columns. Obviously some data could be truncated.

Where I'm trying to head is:

1. Assuming your table is mapped correctly to data types and lengths, would it not be best practice to set the same data types and lengths in your flat file definition? Or...does it matter?

2. Again, back to flexible thinking about the problem and solution. Is there another path that I'm not seeing? Perhaps the definition of data types and lengths for the flat file columns is moot, b/c it is also defined (and overridden) at another point, such as during the mapping or transforms?

Thanks again

Generally, if a flat file column contains integers, you will want to define it as such up front in the flat file connection manager. The more work you do there, the easier the rest of the puzzle will be.

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.

Flat File Connection with quote encapsulated fields

I’m trying to evaluate SSIS for managing the import of files that have quote encapsulated fields, but not all fields are encapsulated. The fields are encapsulated to allow for embedded commas.

For example:

AAA,"BBB",CCC,"DDD","EEE","FFF",GGG,"HHHH",IIII

AAA,"BBB",CCC,"DDD","EE,E","FFF",,"HH,H",

When importing this file I have to alter the delimiter from column AAA to deal with the quote from column BBB like this:

{,}"

And BBB would look like

“{,}

Now I can go through each column for our files doing this by hand, but I wonder if there is some way to note that some fields are encapsulated. Thus it would be more wizard like. Or the ability to alter the Advanced fields while on the Preview or Columns to reduce the jumping across pages.

Also is the gramma for delimiters described anywhere?

Simeon

You should use the "Text Qualifier" property of the Flat File Connection Manager. In this case, you would specify " to be the Text Qualifier. Best part is if some columns are qualified, and some are not qualified, it will still handle them both.

Let me know if you have any problems using the Flat File Connection Manager.

thanks
Ranjeeta

Flat File Connection with different row types

I have a file format that uses many rows to describe relationships between one-to-many entries. Basically in many tables I one file with the only relations between tables been the order of the rows.

From what I’ve found so far, the Flat file Connection is not the correct Connection type to use for this. Is there something better suited, or documentation of creating Connection types.

Cheers Simeon.

This is script source component or custom source adapter territory. I recommend Don Farmer's book "Rational Guide To Scripting" which contains a step-by-step guide to building a script source component.

-Jamiesql

flat file connection string

Hello,
i can't find the connection string (and the def of the options) to
access a flat file from SQL Server 2005.
I guess it is something like:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=MyFlatFile; Extended
Properties=... etc.etc
Can anyone help me?
Thx,
ChrisChris,
please have a look at this site - http://www.connectionstrings.com/
The flat file connection strings are there for ODBC and OLE DB.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

flat file connection string

Hello,
i can't find the connection string (and the def of the options) to
access a flat file from SQL Server 2005.
I guess it is something like:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=MyFlatFile; Extended
Properties=... etc.etc
Can anyone help me?
Thx,
ChrisChris,
please have a look at this site - http://www.connectionstrings.com/
The flat file connection strings are there for ODBC and OLE DB.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Flat file connection manager question

Hi,

I am having problems setting up columns in a flat file connection manager.

The text file I am trying to parse is in this format:

col1 col2 col3 col4 [] col1 col2 col3 col4 [] col1 col2 col3 col4

where [] = {LF}

I've tried all of the different column delimiters, but apparently this file does not use any of the built-in delimiters, such as tab. I think there are just blank spaces between the columns.

I've requested that the file be comma-delimited instead, but in the event that this is not possible, how should I handle this situation?

Thank you

Are you sure it isn't a fixed-width format?|||

Actually I think it is.

|||Yep, start there and see how far you get. Try working with either the fixed-width format or the ragged-right format.

2012年3月21日星期三

Flat file connection manager not parsing file correctly

Hi,

I have a flat file, comma-delimited, with strings in double-quotes.

In the connection manager for the file, I have specified that the Text Qualifier = ""

However, in the preview tab, it still shows the strings as surrounded by the quotes, e.g. "mycol1" whereas it should show mycol1 without the quotes.

Next, when I examine the data in the database after the load, it's messed up there also.

"mycol1" ends up in the database as "mycol1

"mycol2" ends up as "mycol2

This is not right.

I have format set to delimited, header row delimiter crlf, etc.

Any ideas?

Thanks

I sort of see what's happening.

The "mycol1 problem is due to the fact that I have mycol1 set as a string with a length of 6. Because it's not stripping off the double-quotes correctly, it counts the first six characters of "mycol1", which is of course "mycol1. It's counting the first double-quote as a character.

So the question remains, HOW do I get it to recognize the fact that "" are the text delimiters?

I remember setting up this same flat file connection before and it worked, but now it's not.

|||

Nevermind!

The text delimiter is ", not ""!!

doh

sql

Flat File Connection Manager HeaderRowsToSkip not modifiable at runtime?

I have been working with flat file connection managers for a while now, and I have found it very useful to set properties on all types of SSIS objects using expressions that are set to SSIS package variables.

We have recently moved towards using a centralized application configuration infrastructure, so we are now loading up all application configuration information from our own system -- it's actually based off of the 2.0 ConfigurationManager.

I have developed a custom control flow task that will retrieve all of the SSIS variable information from our own application configuration system and set all of the SSIS variables as the first step in a package.

When I have been using this to set the SSIS Variables which are used in expressions for the HeaderRowsToSkip and DataRowsToSkip (there may be others, but I have not tested them yet) properties of flat file connection managers, these values are not being used -- instead it is using the values for the variables that are defined in the package itself (i.e. the default values that I set up in BIDS when developing the package). The ConnectionString property on the flat file connection manager does not exhibit this behavior.

Can anyone provide any insight on this? Is this a bug in SSIS, or is there something that I am missing here?

Thanks in advance.

Sounds like a great big stonking bug to me. Could you log it at Microsoft Connect?

-Jamie

|||certainly will do -- by the way, love your blog -- it's one of my favorite resources for SSIS development issues.|||

Glad to hear it. I really appreciate the feedback.

-Jamie

Flat File Connection Manager does NOT fail

I use Flat File connection manager where I have defined the format of the file as "Ragged Right" (CR,LF Dos file) with no header rows. The columns are fixed width with Row Delimiter "{CR}{LF}".

The problem is when I process a file with incorrect format. The file execution does not throw an error. Instead it throws a warning " There is a partial row at the end of the file.".

How can I force the Flat file connection manager to FAIL if the format of the file is not matched exactly. I would think this would be the default behavior of Connection manager.

ie. If I have Connection manager setup for a dos file with 2 columns. Column 1 is 5 characters long, column 2 is 3 character long, and the end of line characters are CR, LF. However, if I send in file with 10 rows of 1 character and CR LF, the data flow works and processes these rows incorrectly. How can I force the task to fail if incoming file is not in defined format.

The "Ragged Right" format does not have any limitation on the size of the last column (delimited one), so if your file is missing some row delimiters the flat file parser will continue to look for them and probably swallow succeeding row(s).

You can restrict the size of your "ragged right" column by setting the OutputColumnWidth property of those columns on the Advanced page of the Flat File Connection Manager UI. That will make the flat file source fail if the truncation happens. If you would rather to redirect such rows, you can do that by setting "Redirect Row" for Truncation on the Error Output page of the Flat File Source UI, and then define your error flow.

HTH.|||Thanks. It worked.

Flat File Connection Manager

As I have a file whose delimiters can be different. I have need to change the delimiters and filename programatically.

I have come across a way to change the filename using the inbuilt expressions setter. Howver the columns are not listed, possibly because they are on the advanced tab and theoretically each column delimiter could be different.

Will I have to do this through a script or is there an easier method?

As far as I know, this would need need to be handled by a script or a derived column component. You'd need to bring the flat file row in as a single column, then split it up yourself. You could reference a variable in the script or derived column component to determine what delimiter to use.

Here's a few posts that might help with this:

http://blogs.conchango.com/jamiethomson/archive/2006/07/14/4226.aspx

http://agilebi.com/cs/blogs/jwelch/archive/2007/05/07/handling-flat-files-with-varying-numbers-of-columns.aspx

http://agilebi.com/cs/blogs/jwelch/archive/2007/05/15/handling-varying-columns-part-2.aspx

Flat file connection is skipping columns

The data file contains column names in the first row. Excel imports the file correctly. I can see the tabs in UltraEdit32. But...the flat file connection just skips over a column.
In the preview window, it appears to skip the column entirely.

However, when the data is imported, data from the non recognized column goes into a column that is mapped to receive data from another column shifting the data in to the next column.

I am using the CopyColumn and the SQL Destination controls.

Any ideas on how to make this work?

Thanks,
IanOCan you copy 'n paste some of the data here for us to look at?

flat file connection bug

What happens is that the flat file connection non of the columns can be altered

you can set them in other ssis packages but not in the one that you want to use and when it comes to changes the flat file complains that not a correct file is set, even though there is one set,

and when it comes to altering a flat file source it complains that it can not find the connection and the database destination can not find the meta data BUT

when it is run it works perfectly,

so what i have had to resort to is making the part of the dts package in another package and then copying it accross

Do you have delay validation on the connection or source, or are you working off line.

Some of the components don't handle these states very elegantly.

|||

I do not know what you mean buy delay validation, but i am working on the server, connected to the server on the same mechine. the connection string is set to a variable that is set in a file loop, but when i remove, the variable and try it again it stil does not work...

|||

on the top menu you must check that the ssis drop down is not set to offline

flat file connection bug

What happens is that the flat file connection non of the columns can be altered

you can set them in other ssis packages but not in the one that you want to use and when it comes to changes the flat file complains that not a correct file is set, even though there is one set,

and when it comes to altering a flat file source it complains that it can not find the connection and the database destination can not find the meta data BUT

when it is run it works perfectly,

so what i have had to resort to is making the part of the dts package in another package and then copying it accross

Do you have delay validation on the connection or source, or are you working off line.

Some of the components don't handle these states very elegantly.

|||

I do not know what you mean buy delay validation, but i am working on the server, connected to the server on the same mechine. the connection string is set to a variable that is set in a file loop, but when i remove, the variable and try it again it stil does not work...

|||

on the top menu you must check that the ssis drop down is not set to offline

2012年3月11日星期日

Fixed Length File Read

I have a fixed-length flat file that contains about 30 columns. I have got it pretty well figured out using the flat file connection tool, but I am having trouble with the end of the line.

I know when I look at the file it is a CrLf that separates the rows, and SSIS only seems to understand this to a certain extent. It knows to go to the next line, but it also adds two rectangles to the lines, like this:

Col1 Col2 Col3 Col4 Col5
aaaaaa bbbbb ccccc ddddd eeeee

[][]aaaaa bbbbb ccccc ddddd eee
ee[][]aaaaa bbbbb ccccc ddddd e
eeee[][]aaaaa bbbbb ccccc ddddd

While this does create a cool pattern, it is a pain in the butt. The only solution I have found is adding two more spaces to the last column in the table, but the ?s just get appended there.

If anybody has any clue how to get rid of them, that would be great.

Thanks in advance

You have to use the Ragged Right format for this file. The Fixed Width format does not process row delimiters - it treats them as any other characters, and so you are seeing squares in your parsed text.

If you search through this forum you will find several more detailed posts on this topic.

Thanks.