Fixed Width Export Details

You should understand how the Fixed Width Export works. Read the code and see what it's doing.

The fixed width assumes that each line will be terminated by vbCrLf (CHAR(13) + CHAR(10)

My #1 concern was how to handle varchar(max) fields; My solution for now is to get the widest current value in the dataset itself, and make that the width of the field.

if a field is defined as a VARCHAR(30), no problem, the max width is 30 characters.

That means, depending on the data, you could export today and the data is 100 characters wide, but an export tomorrow , because of a data change, could be more or less characters in width per row.
keep that in mind with varchar(max) fields, you might want to explicitly convert them to things like CONVERT(varchar(500),myVarcharMax) to set the width accurately if you are using this method for a regular ETL /import/ Export process.

Last edited May 4, 2012 at 7:29 PM by lizaguirre, version 2


No comments yet.